1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5 #[error("Serialization error: {0}")]
6 SerializationError(#[from] serde_json::Error),
7
8 #[error("Parsing error: {0}")]
9 ParsingError(String),
10
11 #[error("Cryptographic error: {0}")]
12 CryptographicError(String),
13
14 #[error("Other error: {0}")]
15 Other(String),
16}
17
18#[allow(dead_code)]
19#[derive(Debug, thiserror::Error)]
20pub enum MatterError {
21 #[error("Invalid code: {0}")]
22 InvalidCode(String),
23
24 #[error("Invalid code size: {0}")]
25 InvalidCodeSize(String),
26
27 #[error("Invalid size for raw material")]
28 InvalidSize,
29
30 #[error("Invalid format for encoded material")]
31 InvalidFormat,
32
33 #[error("Invalid value: {0}")]
34 InvalidValue(String),
35
36 #[error("Deserialization error: {0}")]
37 DeserializationError(String),
38
39 #[error("Serialization error: {0}")]
40 SerializationError(String),
41
42 #[error("Invalid QB64")]
43 InvalidQb64,
44
45 #[error("Invalid qb64 length")]
46 InvalidQb64Length,
47
48 #[error("Invalid base64")]
49 InvalidBase64,
50
51 #[error("Invalid raw size")]
52 InvalidRawSize,
53
54 #[error("Shortage: {0}")]
55 ShortageError(String),
56
57 #[error("Unexpected count code: {0}")]
58 UnexpectedCountCodeError(String),
59
60 #[error("Unexpected op code: {0}")]
61 UnexpectedOpCodeError(String),
62
63 #[error("Unexpected code: {0}")]
64 UnexpectedCodeError(String),
65
66 #[error("Unsupported code: {0}")]
67 UnsupportedCodeError(String),
68
69 #[error("Conversion error: {0}")]
70 ConversionError(String),
71
72 #[error("Empty material: {0}")]
73 EmptyMaterial(String),
74
75 #[error("Type Error: {0}")]
76 TypeError(String),
77
78 #[error("Invalid raw size: {0}")]
79 InvalidVarRawSize(String),
80
81 #[error("Soft material: {0}")]
82 SoftMaterial(String),
83
84 #[error("Invalid soft: {0}")]
85 InvalidSoft(String),
86
87 #[error("Raw material: {0}")]
88 RawMaterial(String),
89
90 #[error("Shortage error: {0}")]
91 Shortage(String),
92
93 #[error("Unexpected count code: {0}")]
94 UnexpectedCountCode(String),
95
96 #[error("Unexpected op code: {0}")]
97 UnexpectedOpCode(String),
98
99 #[error("Unexpected code: {0}")]
100 UnexpectedCode(String),
101
102 #[error("Conversion error: {0}")]
103 Conversion(String),
104
105 #[error("Invalid base64 index: {0}")]
106 InvalidBase64Index(usize),
107
108 #[error("Invalid soft error: {0}")]
109 InvalidSoftError(String),
110
111 #[error("Soft material error: {0}")]
112 SoftMaterialError(String),
113
114 #[error("Empty material error: {0}")]
115 EmptyMaterialError(String),
116
117 #[error("Invalid var index error: {0}")]
118 InvalidVarIndexError(String),
119
120 #[error("Invalid code size error: {0}")]
121 InvalidCodeSizeError(String),
122
123 #[error("Raw material error: {0}")]
124 RawMaterialError(String),
125
126 #[error("Validation error: {0}")]
127 ValidationError(String),
128
129 #[error("Value error: {0}")]
130 ValueError(String),
131
132 #[error("Encoding error: {0}")]
133 EncodingError(String),
134
135 #[error("Overflow error: {0}")]
136 OverflowError(String),
137
138 #[error("Invalid variable index: {0}")]
139 InvalidVarIndex(String),
140
141 #[error("Base64 encoding error: {0}")]
142 Base64Error(String),
143
144 #[error("Invalid key length: expected {expected}, got {actual}")]
145 InvalidKeyLength { expected: usize, actual: usize },
146
147 #[error("Invalid signature length: expected {expected}, got {actual}")]
148 InvalidSignatureLength { expected: usize, actual: usize },
149
150 #[error("Verification error: {0}")]
151 VerificationError(String),
152
153 #[error("Secp256k1 error: {0}")]
154 Secp256k1Error(String),
155
156 #[error("Secp256r1 error: {0}")]
157 Secp256r1Error(String),
158
159 #[error("Hash error: {0}")]
160 HashError(String),
161
162 #[error("Invalid threshold: {0}")]
163 InvalidThreshold(String),
164
165 #[error("Weight value error: {0}")]
166 WeightError(String),
167
168 #[error("Parse error: {0}")]
169 ParseError(String),
170
171 #[error("Cold start error: {0}")]
172 ColdStartError(String),
173
174 #[error("Need more data")]
175 NeedMoreDataError(String),
176
177 #[error("Not implemented: {0}")]
178 NotImplementedError(String),
179
180 #[error("Unknow Message: {0}")]
181 UnknownMessageTypeError(String),
182
183 #[error("CryptoError: {0}")]
184 CryptoError(String),
185
186 #[error("Invalid key: {0}")]
187 InvalidKey(String),
188
189 #[error("Decoding error: {0}")]
190 DecodingError(String),
191}