@@ -42,10 +42,6 @@ struct Bad {
4242// AppError trait
4343
4444pub trait AppError : Send + fmt:: Display + fmt:: Debug + ' static {
45- fn cause ( & self ) -> Option < & ( dyn AppError ) > {
46- None
47- }
48-
4945 /// Generate an HTTP response for the error
5046 ///
5147 /// If none is returned, the error will bubble up the middleware stack
@@ -80,9 +76,6 @@ impl dyn AppError {
8076}
8177
8278impl AppError for Box < dyn AppError > {
83- fn cause ( & self ) -> Option < & dyn AppError > {
84- ( * * self ) . cause ( )
85- }
8679 fn response ( & self ) -> Option < Response > {
8780 ( * * self ) . response ( )
8881 }
@@ -148,9 +141,6 @@ impl<T> ChainError<T> for Option<T> {
148141}
149142
150143impl < E : AppError > AppError for ChainedError < E > {
151- fn cause ( & self ) -> Option < & dyn AppError > {
152- Some ( & * self . cause )
153- }
154144 fn response ( & self ) -> Option < Response > {
155145 self . error . response ( )
156146 }
@@ -284,15 +274,7 @@ impl Error for AppErrToStdErr {}
284274
285275impl fmt:: Display for AppErrToStdErr {
286276 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)
296278 }
297279}
298280
0 commit comments