ockam_entity/
error.rs

1#[derive(Clone, Copy, Debug)]
2pub enum EntityError {
3    BareError = 1,
4    VerifyFailed,
5    InvalidInternalState,
6    InvalidProof,
7    ConsistencyError,
8    ComplexEventsAreNotSupported,
9    EventIdDoesNotMatch,
10    ProfileIdDoesNotMatch,
11    EmptyChange,
12    ContactNotFound,
13    EventNotFound,
14    InvalidChainSequence,
15    InvalidEventId,
16    AttestationRequesterDoesNotMatch,
17    AttestationNonceDoesNotMatch,
18    InvalidHubResponse,
19    InvalidParameter,
20    SecureChannelVerificationFailed,
21    SecureChannelTrustCheckFailed,
22    SecureChannelCannotBeAuthenticated,
23    ProfileInvalidResponseType,
24    ProfileNotFound,
25    NotImplemented,
26    UnknownChannelMsgDestination,
27    UnknownChannelMsgOrigin,
28    InvalidLocalInfoType,
29    InvalidSecureChannelInternalState,
30    IdentityApiFailed,
31    ContactVerificationFailed,
32    InvalidProfileId,
33    DuplicateCredential,
34    CredentialNotFound,
35    InvalidIssueState,
36    CredentialTrustCheckFailed,
37    SchemaIdDoesNotMatch,
38    IssuerListenerInvalidMessage,
39    HolderInvalidMessage,
40    IssuerInvalidMessage,
41    PresenterInvalidMessage,
42    VerifierInvalidMessage,
43}
44
45impl EntityError {
46    /// Integer code associated with the error domain.
47    pub const DOMAIN_CODE: u32 = 20_000;
48    /// Descriptive name for the error domain.
49    pub const DOMAIN_NAME: &'static str = "OCKAM_ENTITY";
50}
51
52impl From<EntityError> for ockam_core::Error {
53    fn from(e: EntityError) -> ockam_core::Error {
54        ockam_core::Error::new(
55            EntityError::DOMAIN_CODE + (e as u32),
56            EntityError::DOMAIN_NAME,
57        )
58    }
59}