Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changed IO to UIO as as underline repository doesn't throw error #1271

Merged
merged 3 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
ZIO
.service[PresentationService]
.flatMap(_.reportProcessingFailure(record.id, Some(ex)))
.catchAll(ex =>
ZIO.logErrorCause(s"PresentBackgroundJobs - Fail to recover from ${record.id}", Cause.fail(ex))
)
case ex => ZIO.logErrorCause(s"PresentBackgroundJobs - Error processing record: ${record.id}", Cause.fail(ex))
}
.catchAllDefect(d =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ trait PresentationService {
def reportProcessingFailure(
recordId: DidCommID,
failReason: Option[Failure]
): IO[PresentationError, Unit]
): UIO[Unit]

}
Original file line number Diff line number Diff line change
Expand Up @@ -1101,7 +1101,7 @@ private class PresentationServiceImpl(
override def reportProcessingFailure(
recordId: DidCommID,
failReason: Option[Failure]
): IO[PresentationError, Unit] =
): UIO[Unit] =
presentationRepository.updateAfterFail(recordId, failReason)

private def getRecordFromThreadId(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import org.hyperledger.identus.pollux.core.service.serdes.{AnoncredCredentialPro
import org.hyperledger.identus.pollux.sdjwt.{HolderPrivateKey, PresentationCompact}
import org.hyperledger.identus.pollux.vc.jwt.{Issuer, PresentationPayload, W3cCredentialPayload}
import org.hyperledger.identus.shared.models.*
import zio.{IO, URLayer, ZIO, ZLayer}
import zio.{IO, UIO, URLayer, ZIO, ZLayer}
import zio.json.*

import java.time.Instant
Expand Down Expand Up @@ -281,7 +281,7 @@ class PresentationServiceNotifier(
override def reportProcessingFailure(
recordId: DidCommID,
failReason: Option[Failure]
): IO[PresentationError, Unit] = svc.reportProcessingFailure(recordId, failReason)
): UIO[Unit] = svc.reportProcessingFailure(recordId, failReason)
}

object PresentationServiceNotifier {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ object PresentationRepositorySpecSuite {
exit <- repo.updatePresentationWithCredentialsToUse(record2.id, Option(Nil), newState).provide(wallet2).exit
} yield assert(exit)(dies(hasMessage(equalTo("Unexpected affected row count: 0"))))
},
test("unable to updateAfterFail PresentationRecord outside of the wallet") {
test("updateAfterFail PresentationRecord outside of the wallet") {
val walletId1 = WalletId.random
val walletId2 = WalletId.random
val wallet1 = ZLayer.succeed(WalletAccessContext(walletId1))
Expand All @@ -442,7 +442,6 @@ object PresentationRepositorySpecSuite {
record2.id,
Some(FailureInfo("PresentationRepositorySpecSuite", StatusCode(999), "fail reason"))
)
.provide(wallet2)
.exit
} yield assert(exit)(dies(hasMessage(equalTo("Unexpected affected row count: 0"))))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.hyperledger.identus.shared.models.*
import zio.{mock, IO, URLayer, ZIO, ZLayer}
import zio.json.*
import zio.mock.{Mock, Proxy}
import zio.UIO

import java.time.Instant
import java.util.UUID
Expand Down Expand Up @@ -262,7 +263,7 @@ object MockPresentationService extends Mock[PresentationService] {
override def reportProcessingFailure(
recordId: DidCommID,
failReason: Option[Failure]
): IO[PresentationError, Unit] = ???
): UIO[Unit] = ???

}
}
Expand Down
Loading