File tree Expand file tree Collapse file tree 1 file changed +1
-1
lines changed
examples/error-handling/src Expand file tree Collapse file tree 1 file changed +1
-1
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,7 @@ impl IntoResponse for AppError {
185185 let mut response = ( status, AppJson ( ErrorResponse { message } ) ) . into_response ( ) ;
186186 if let Some ( err) = err {
187187 // Insert our error into the response, our logging middleware will use this.
188+ // By wrapping the error in an Arc we can use it as an Extension regardless of any inner types not deriving Clone.
188189 response. extensions_mut ( ) . insert ( Arc :: new ( err) ) ;
189190 }
190191 response
@@ -193,7 +194,6 @@ impl IntoResponse for AppError {
193194
194195impl From < JsonRejection > for AppError {
195196 fn from ( rejection : JsonRejection ) -> Self {
196- // Arc enables cloning of a JsonRejection
197197 Self :: JsonRejection ( rejection)
198198 }
199199}
You can’t perform that action at this time.
0 commit comments