@@ -21,6 +21,7 @@ pub type AtomicResult<T> = std::result::Result<T, AtomicError>;
2121pub struct AtomicError {
2222 pub message : String ,
2323 pub error_type : AtomicErrorType ,
24+ pub subject : Option < String > ,
2425}
2526
2627#[ derive( Debug , Clone ) ]
@@ -44,6 +45,7 @@ impl AtomicError {
4445 AtomicError {
4546 message : format ! ( "Resource not found. {}" , message) ,
4647 error_type : AtomicErrorType :: NotFoundError ,
48+ subject : None ,
4749 }
4850 }
4951
@@ -52,6 +54,7 @@ impl AtomicError {
5254 AtomicError {
5355 message : format ! ( "Unauthorized. {}" , message) ,
5456 error_type : AtomicErrorType :: UnauthorizedError ,
57+ subject : None ,
5558 }
5659 }
5760
@@ -60,6 +63,7 @@ impl AtomicError {
6063 AtomicError {
6164 message,
6265 error_type : AtomicErrorType :: OtherError ,
66+ subject : None ,
6367 }
6468 }
6569
@@ -80,6 +84,7 @@ impl AtomicError {
8084
8185 AtomicError {
8286 message : msg,
87+ subject : None ,
8388 error_type : AtomicErrorType :: ParseErrror ,
8489 }
8590 }
@@ -105,6 +110,7 @@ impl From<&str> for AtomicError {
105110 AtomicError {
106111 message : message. into ( ) ,
107112 error_type : AtomicErrorType :: OtherError ,
113+ subject : None ,
108114 }
109115 }
110116}
@@ -113,6 +119,7 @@ impl From<String> for AtomicError {
113119 fn from ( message : String ) -> Self {
114120 AtomicError {
115121 message,
122+ subject : None ,
116123 error_type : AtomicErrorType :: OtherError ,
117124 }
118125 }
@@ -122,6 +129,7 @@ impl From<std::boxed::Box<dyn std::error::Error>> for AtomicError {
122129 fn from ( error : std:: boxed:: Box < dyn std:: error:: Error > ) -> Self {
123130 AtomicError {
124131 message : error. to_string ( ) ,
132+ subject : None ,
125133 error_type : AtomicErrorType :: OtherError ,
126134 }
127135 }
@@ -133,6 +141,7 @@ impl<T> From<std::sync::PoisonError<T>> for AtomicError {
133141 AtomicError {
134142 message : error. to_string ( ) ,
135143 error_type : AtomicErrorType :: OtherError ,
144+ subject : None ,
136145 }
137146 }
138147}
@@ -141,6 +150,7 @@ impl From<std::io::Error> for AtomicError {
141150 fn from ( error : std:: io:: Error ) -> Self {
142151 AtomicError {
143152 message : error. to_string ( ) ,
153+ subject : None ,
144154 error_type : AtomicErrorType :: OtherError ,
145155 }
146156 }
@@ -151,6 +161,7 @@ impl From<url::ParseError> for AtomicError {
151161 AtomicError {
152162 message : error. to_string ( ) ,
153163 error_type : AtomicErrorType :: OtherError ,
164+ subject : None ,
154165 }
155166 }
156167}
@@ -160,6 +171,7 @@ impl From<serde_json::Error> for AtomicError {
160171 AtomicError {
161172 message : error. to_string ( ) ,
162173 error_type : AtomicErrorType :: OtherError ,
174+ subject : None ,
163175 }
164176 }
165177}
@@ -169,6 +181,7 @@ impl From<std::string::FromUtf8Error> for AtomicError {
169181 AtomicError {
170182 message : error. to_string ( ) ,
171183 error_type : AtomicErrorType :: OtherError ,
184+ subject : None ,
172185 }
173186 }
174187}
@@ -178,6 +191,7 @@ impl From<ParseFloatError> for AtomicError {
178191 AtomicError {
179192 message : error. to_string ( ) ,
180193 error_type : AtomicErrorType :: OtherError ,
194+ subject : None ,
181195 }
182196 }
183197}
@@ -186,6 +200,7 @@ impl From<ParseIntError> for AtomicError {
186200 fn from ( error : ParseIntError ) -> Self {
187201 AtomicError {
188202 message : error. to_string ( ) ,
203+ subject : None ,
189204 error_type : AtomicErrorType :: OtherError ,
190205 }
191206 }
@@ -196,6 +211,7 @@ impl From<DecodeError> for AtomicError {
196211 AtomicError {
197212 message : error. to_string ( ) ,
198213 error_type : AtomicErrorType :: OtherError ,
214+ subject : None ,
199215 }
200216 }
201217}
@@ -204,6 +220,7 @@ impl From<ParseBoolError> for AtomicError {
204220 fn from ( error : ParseBoolError ) -> Self {
205221 AtomicError {
206222 message : error. to_string ( ) ,
223+ subject : None ,
207224 error_type : AtomicErrorType :: OtherError ,
208225 }
209226 }
@@ -214,6 +231,7 @@ impl From<Infallible> for AtomicError {
214231 AtomicError {
215232 message : error. to_string ( ) ,
216233 error_type : AtomicErrorType :: OtherError ,
234+ subject : None ,
217235 }
218236 }
219237}
@@ -224,6 +242,7 @@ impl From<sled::Error> for AtomicError {
224242 AtomicError {
225243 message : error. to_string ( ) ,
226244 error_type : AtomicErrorType :: OtherError ,
245+ subject : None ,
227246 }
228247 }
229248}
@@ -233,6 +252,7 @@ impl From<Box<bincode::ErrorKind>> for AtomicError {
233252 fn from ( error : Box < bincode:: ErrorKind > ) -> Self {
234253 AtomicError {
235254 message : error. to_string ( ) ,
255+ subject : None ,
236256 error_type : AtomicErrorType :: OtherError ,
237257 }
238258 }
0 commit comments