1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// OAS Spec §5 — OAS Identity Document
//! Error types for OAS document operations.
use thiserror::Error;
/// Errors arising from OAS Identity Document operations.
#[derive(Debug, Error)]
pub enum DocumentError {
/// The document is missing a required field.
#[error("missing required field '{field}' in OAS Identity Document")]
MissingField {
/// The name of the missing field.
field: String,
},
/// A field value is invalid.
#[error("invalid value for field '{field}': {reason}")]
InvalidField {
/// The field name.
field: String,
/// Why the value is invalid.
reason: String,
},
/// Document proof verification failed.
#[error("document proof verification failed: {reason}")]
ProofVerificationFailed {
/// Why verification failed.
reason: String,
},
/// Document proof generation failed.
#[error("document proof generation failed: {reason}")]
ProofGenerationFailed {
/// Why generation failed.
reason: String,
},
/// Conformance level requirements not met.
#[error("conformance level {level} requirements not met: {reason}")]
ConformanceNotMet {
/// The conformance level that was not met.
level: String,
/// What requirement was not satisfied.
reason: String,
},
/// JSON serialization/deserialization failed.
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
/// DID parsing failed.
#[error("DID error: {0}")]
Did(#[from] oas_did::DidError),
/// Cryptographic operation failed.
#[error("crypto error: {0}")]
Crypto(#[from] oas_crypto::CryptoError),
/// The lifecycle status transition is not allowed.
#[error("invalid lifecycle transition from '{from}' to '{to}'")]
InvalidLifecycleTransition {
/// Current status.
from: String,
/// Attempted new status.
to: String,
},
/// Sequence number is not valid.
#[error("invalid sequence number {sequence}: {reason}")]
InvalidSequence {
/// The invalid sequence number.
sequence: u64,
/// Why it's invalid.
reason: String,
},
}