Skip to content

Commit

Permalink
Fixes after Review
Browse files Browse the repository at this point in the history
Signed-off-by: FabioPinheiro <[email protected]>
  • Loading branch information
FabioPinheiro committed Jun 26, 2024
1 parent eedcaa7 commit 25079db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import org.hyperledger.identus.castor.core.model.error.DIDResolutionError as Cas
import org.hyperledger.identus.castor.core.service.DIDService
import org.hyperledger.identus.mercury.*
import org.hyperledger.identus.mercury.model.*
import org.hyperledger.identus.mercury.model.error.TransportError
import org.hyperledger.identus.mercury.protocol.presentproof.*
import org.hyperledger.identus.mercury.protocol.reportproblem.v2.{ProblemCode, ReportProblem}
import org.hyperledger.identus.pollux.core.model.*
Expand Down Expand Up @@ -84,7 +83,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
aux(record)
.tapError({
(error: PresentationError | DIDSecretStorageError | BackgroundJobError | CredentialServiceError |
CastorDIDResolutionError | GetManagedDIDError | TransportError | Failure) =>
CastorDIDResolutionError | GetManagedDIDError | Failure) =>
ZIO.logErrorCause(
s"Present Proof - Error processing record: ${record.id}",
Cause.fail(error)
Expand Down Expand Up @@ -999,7 +998,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
presentation: Presentation
): ZIO[
PresentationService & DIDNonSecretStorage & MESSAGING_RESOURCES,
PresentationError | DIDSecretStorageError | TransportError,
PresentationError | DIDSecretStorageError,
Unit
] = {
for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ sealed trait DIDSecretStorageError(
object DIDSecretStorageError {
case class KeyNotFoundError(didId: DidId, keyId: String)
extends DIDSecretStorageError(
StatusCode.InternalServerError,
StatusCode.NotFound,
s"The not found: keyId='$keyId', didId='$didId'"
)
case class WalletNotFoundError(didId: DidId)
extends DIDSecretStorageError(
StatusCode.InternalServerError,
StatusCode.NotFound,
s"The DID not Found in Wallet: didId='$didId'"
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,13 @@ package org.hyperledger.identus.mercury.model

import org.hyperledger.identus.shared.models._

import java.io.IOException

package object error {

type MercuryException = MercuryError | IOException
type MercuryThrowable = MercuryError | IOException | Throwable // REMOVE Throwable

def mercuryErrorAsThrowable(error: MercuryThrowable): java.lang.Throwable = error match
case ex: MercuryError => ex.toUnmanagedFailureException
case ex: IOException => ex
case ex: Throwable => ex

sealed trait MercuryError extends Failure {
override val namespace: String = "MercuryError"
}

trait TransportError extends MercuryError

sealed case class SendMessageError(cause: Throwable, mData: Option[String] = None)
extends RuntimeException(
s"Error when sending message: ${cause.getMessage};${mData.map(e => s" DATA:'$e'").getOrElse("")}",
cause
)
with TransportError {
sealed case class SendMessageError(cause: Throwable, mData: Option[String] = None) extends MercuryError {
override val statusCode = StatusCode.BadRequest
override val userFacingMessage =
s"Error when sending message: ${cause.getMessage};${mData.map(e => s" DATA:'$e'").getOrElse("")}. "
Expand Down

0 comments on commit 25079db

Please sign in to comment.