mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-19 00:00:14 +02:00
Fix misplaced comment in error handling example (#3529)
This commit is contained in:
@@ -185,6 +185,7 @@ impl IntoResponse for AppError {
|
||||
let mut response = (status, AppJson(ErrorResponse { message })).into_response();
|
||||
if let Some(err) = err {
|
||||
// Insert our error into the response, our logging middleware will use this.
|
||||
// By wrapping the error in an Arc we can use it as an Extension regardless of any inner types not deriving Clone.
|
||||
response.extensions_mut().insert(Arc::new(err));
|
||||
}
|
||||
response
|
||||
@@ -193,7 +194,6 @@ impl IntoResponse for AppError {
|
||||
|
||||
impl From<JsonRejection> for AppError {
|
||||
fn from(rejection: JsonRejection) -> Self {
|
||||
// Arc enables cloning of a JsonRejection
|
||||
Self::JsonRejection(rejection)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user