mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-29 00:00:18 +02:00
Move axum-handle-error-extract into axum (#534)
* Move `axum-handle-error-extract` into axum With 0.4 underway we can now nuke `axum-handle-error-extract` and move its code directly into axum. So this replaces the old `HandleErrorLayer` with one that supports async functions and extractors. * changelog * fix CI
This commit is contained in:
@@ -49,7 +49,7 @@ async fn main() {
|
||||
// Add middleware to all routes
|
||||
.layer(
|
||||
ServiceBuilder::new()
|
||||
.layer(HandleErrorLayer::new(|error: BoxError| {
|
||||
.layer(HandleErrorLayer::new(|error: BoxError| async move {
|
||||
if error.is::<tower::timeout::error::Elapsed>() {
|
||||
Ok(StatusCode::REQUEST_TIMEOUT)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user