Skip to content

Commit 37a08a1

Browse files
authored
Fix misplaced comment in error handling example (#3529)
1 parent 8389ab1 commit 37a08a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/error-handling/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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

194195
impl From<JsonRejection> for AppError {
195196
fn from(rejection: JsonRejection) -> Self {
196-
// Arc enables cloning of a JsonRejection
197197
Self::JsonRejection(rejection)
198198
}
199199
}

0 commit comments

Comments
 (0)