-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Credential Defintion Error Handling Part 2 (#1155)
Signed-off-by: Bassam Riman <[email protected]>
- Loading branch information
1 parent
d6dfb72
commit 2df5306
Showing
16 changed files
with
137 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
.../scala/org/hyperledger/identus/pollux/core/service/CredentialDefinitionServiceError.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.hyperledger.identus.pollux.core.service | ||
|
||
import org.hyperledger.identus.pollux.core.model.error.CredentialSchemaError | ||
import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema | ||
import org.hyperledger.identus.pollux.core.model.schema.CredentialSchema.* | ||
import org.hyperledger.identus.shared.models.{Failure, StatusCode} | ||
|
||
import java.util.UUID | ||
|
||
sealed trait CredentialDefinitionServiceError( | ||
val statusCode: StatusCode, | ||
val userFacingMessage: String | ||
) extends Failure { | ||
override val namespace = "CredentialDefinition" | ||
} | ||
|
||
final case class CredentialDefinitionGuidNotFoundError(guid: UUID) | ||
extends CredentialDefinitionServiceError( | ||
StatusCode.NotFound, | ||
s"Credential Definition record cannot be found by `guid`=$guid" | ||
) | ||
|
||
final case class CredentialDefinitionUpdateError(id: UUID, version: String, author: String, message: String) | ||
extends CredentialDefinitionServiceError( | ||
StatusCode.BadRequest, | ||
s"Credential Definition update error: id=$id, version=$version, author=$author, msg=$message" | ||
) | ||
|
||
final case class CredentialDefinitionCreationError(msg: String) | ||
extends CredentialDefinitionServiceError( | ||
StatusCode.BadRequest, | ||
s"Credential Definition Creation Error=${msg}" | ||
) | ||
|
||
final case class CredentialDefinitionValidationError(cause: CredentialSchemaError) | ||
extends CredentialDefinitionServiceError( | ||
StatusCode.BadRequest, | ||
s"Credential Definition Validation Error=${cause.message}" | ||
) |
Oops, something went wrong.