Skip to main content

agent_id_core/
error.rs

1//! Error types for agent-id-core.
2
3use thiserror::Error;
4
5#[derive(Debug, Error)]
6pub enum Error {
7    #[error("Invalid DID format: {0}")]
8    InvalidDid(String),
9
10    #[error("Invalid signature")]
11    InvalidSignature,
12
13    #[error("Key generation failed: {0}")]
14    KeyGeneration(String),
15
16    #[error("Serialization error: {0}")]
17    Serialization(#[from] serde_json::Error),
18
19    #[error("Invalid base58 encoding: {0}")]
20    Base58(String),
21
22    #[error("Delegation expired")]
23    DelegationExpired,
24
25    #[error("Delegation not yet valid")]
26    DelegationNotYetValid,
27
28    #[error("Invalid delegation chain")]
29    InvalidDelegationChain,
30
31    #[error("Validation error: {0}")]
32    Validation(String),
33
34    #[error("Key revoked")]
35    KeyRevoked,
36
37    #[error("Recovery pending")]
38    RecoveryPending,
39
40    #[error("Recovery cancelled")]
41    RecoveryCancelled,
42}