Skip to content

Commit

Permalink
Improved the error reporting
Browse files Browse the repository at this point in the history
Signed-off-by: mineme0110 <[email protected]>
  • Loading branch information
mineme0110 committed Nov 18, 2024
1 parent 44417ab commit a0f8435
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {

object Verifier {

def handleRequestPending(id: DidCommID, record: RequestPresentation): ZIO[
def handleRequestPending(id: DidCommID, requestPresentation: RequestPresentation): ZIO[
JwtDidResolver & COMMON_RESOURCES & MESSAGING_RESOURCES,
Failure,
Unit
Expand Down Expand Up @@ -979,17 +979,20 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {

val verifierReqPendingToSentFlow = for {
_ <- ZIO.log(s"PresentationRecord: RequestPending (Send Message)")
walletAccessContext <- buildWalletAccessContextLayer(
record.from.getOrElse(throw new RuntimeException("from is None is not possible"))
)
walletAccessContext <- ZIO
.fromOption(requestPresentation.from)
.mapError(_ => RequestPresentationMissingField(id.value, "sender"))
.flatMap(buildWalletAccessContextLayer)

result <- for {
didOps <- ZIO.service[DidOps]
didCommAgent <- buildDIDCommAgent(
record.from.getOrElse(throw new RuntimeException("from is None is not possible"))
).provideSomeLayer(ZLayer.succeed(walletAccessContext))
didCommAgent <- ZIO
.fromOption(requestPresentation.from)
.mapError(_ => RequestPresentationMissingField(id.value, "sender"))
.flatMap(buildDIDCommAgent(_).provideSomeLayer(ZLayer.succeed(walletAccessContext)))
resp <-
MessagingService
.send(record.makeMessage)
.send(requestPresentation.makeMessage)
.provideSomeLayer(didCommAgent)
@@ Metric
.gauge("present_proof_flow_verifier_send_presentation_request_msg_ms_gauge")
Expand Down

0 comments on commit a0f8435

Please sign in to comment.