keri/error/
mod.rs

1use base64::DecodeError;
2use core::num::ParseIntError;
3use ed25519_dalek;
4use rmp_serde as serde_mgpk;
5use serde_cbor;
6use serde_json;
7use thiserror::Error;
8
9pub mod serializer_error;
10
11#[derive(Error, Debug)]
12pub enum Error {
13    #[error("Error during Serialization: {0}")]
14    SerializationError(String),
15
16    #[error("JSON Serialization error")]
17    JSONSerializationError {
18        #[from]
19        source: serde_json::Error,
20    },
21
22    #[error("CBOR Serialization error")]
23    CBORSerializationError {
24        #[from]
25        source: serde_cbor::Error,
26    },
27
28    #[error("MessagePack Serialization error")]
29    MsgPackSerializationError {
30        #[from]
31        source: serde_mgpk::encode::Error,
32    },
33
34    #[error("Error parsing numerical value: {source}")]
35    IntegerParseValue {
36        #[from]
37        source: ParseIntError,
38    },
39
40    #[error("Error while applying event: {0}")]
41    SemanticError(String),
42
43    #[error("Event signature verification faulty")]
44    FaultySignatureVerification,
45
46    #[error("Error while applying event: out of order event")]
47    EventOutOfOrderError,
48
49    #[error("Error while applying event: duplicate event")]
50    EventDuplicateError,
51
52    #[error("Not enough signatures while verifying")]
53    NotEnoughSigsError,
54
55    #[error("Signature verification failed")]
56    SignatureVerificationError,
57
58    #[error("Deserialize error: {0}")]
59    DeserializeError(String),
60
61    #[error("Identifier is not indexed into the DB")]
62    NotIndexedError,
63
64    #[error("Identifier ID is already present in the DB")]
65    IdentifierPresentError,
66
67    #[error("Base64 Decoding error")]
68    Base64DecodingError {
69        #[from]
70        source: DecodeError,
71    },
72
73    #[error("Improper Prefix Type")]
74    ImproperPrefixType,
75
76    #[error("Storage error")]
77    StorageError,
78
79    #[error("Invalid identifier state")]
80    InvalidIdentifierStat,
81
82    #[cfg(feature = "async")]
83    #[error("Zero send error")]
84    ZeroSendError,
85
86    #[error("Failed to obtain mutable ref to Ark of KeyManager")]
87    MutArcKeyVaultError,
88
89    #[error(transparent)]
90    Ed25519DalekSignatureError(#[from] ed25519_dalek::SignatureError),
91
92    #[error(transparent)]
93    SledError(#[from] sled::Error),
94
95    #[error(transparent)]
96    SerdeSerError(#[from] serializer_error::Error),
97
98    #[cfg(feature = "wallet")]
99    #[error(transparent)]
100    WalletError(#[from] universal_wallet::Error),
101
102    #[error("mutex is poisoned")]
103    MutexPoisoned,
104
105    #[error("Incorrect event digest")]
106    IncorrectDigest,
107
108    #[cfg(feature = "query")]
109    #[error(transparent)]
110    QueryError(#[from] crate::query::QueryError),
111
112    #[error("Public Key Error: {0}")]
113    PublicKeyError(String),
114}