@@ -42,10 +42,6 @@ struct Bad {
42
42
// AppError trait
43
43
44
44
pub trait AppError : Send + fmt:: Display + fmt:: Debug + ' static {
45
- fn cause ( & self ) -> Option < & ( dyn AppError ) > {
46
- None
47
- }
48
-
49
45
/// Generate an HTTP response for the error
50
46
///
51
47
/// If none is returned, the error will bubble up the middleware stack
@@ -80,9 +76,6 @@ impl dyn AppError {
80
76
}
81
77
82
78
impl AppError for Box < dyn AppError > {
83
- fn cause ( & self ) -> Option < & dyn AppError > {
84
- ( * * self ) . cause ( )
85
- }
86
79
fn response ( & self ) -> Option < Response > {
87
80
( * * self ) . response ( )
88
81
}
@@ -148,9 +141,6 @@ impl<T> ChainError<T> for Option<T> {
148
141
}
149
142
150
143
impl < E : AppError > AppError for ChainedError < E > {
151
- fn cause ( & self ) -> Option < & dyn AppError > {
152
- Some ( & * self . cause )
153
- }
154
144
fn response ( & self ) -> Option < Response > {
155
145
self . error . response ( )
156
146
}
@@ -284,15 +274,7 @@ impl Error for AppErrToStdErr {}
284
274
285
275
impl fmt:: Display for AppErrToStdErr {
286
276
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
287
- write ! ( f, "{}" , self . 0 ) ?;
288
-
289
- let mut err = & * self . 0 ;
290
- while let Some ( cause) = err. cause ( ) {
291
- err = cause;
292
- write ! ( f, "\n Caused by: {}" , err) ?;
293
- }
294
-
295
- Ok ( ( ) )
277
+ self . 0 . fmt ( f)
296
278
}
297
279
}
298
280
0 commit comments