Skip to main content

affinidi_secrets_resolver/
errors.rs

1/*!
2 * Secrets Manager Errors
3 */
4
5use affinidi_crypto::CryptoError;
6use affinidi_encoding::EncodingError;
7use thiserror::Error;
8
9/// Affinidi Secrets Resolver Errors
10///
11/// This type is `#[non_exhaustive]`: callers must include a wildcard arm when
12/// matching, so future additions do not constitute breaking changes.
13#[derive(Error, Debug)]
14#[non_exhaustive]
15pub enum SecretsResolverError {
16    #[error("Encoding error: {0}")]
17    EncodingError(#[from] EncodingError),
18
19    #[error("Crypto error: {0}")]
20    CryptoError(#[from] CryptoError),
21
22    #[error("Authentication Error: {0}")]
23    AuthenticationError(String),
24    #[error("Key Error: {0}")]
25    KeyError(String),
26
27    #[error("Encoding Error: {0}")]
28    Encoding(String),
29
30    #[error("Decoding Error: {0}")]
31    Decoding(String),
32
33    #[error("Unexpected Codec: {0}")]
34    UnexpectedCodec(String),
35
36    #[error("Unsupported Key Type: {0}")]
37    UnsupportedKeyType(String),
38}
39
40pub type Result<T> = std::result::Result<T, SecretsResolverError>;