diff --git a/src/server/error.rs b/src/server/error.rs index 0ba8ec87..673a5dd7 100644 --- a/src/server/error.rs +++ b/src/server/error.rs @@ -93,7 +93,7 @@ impl IntoResponse for Error { let status_code = self.to_status_code(); let body = if let Self::Other(err) = self { - format!("{err:?}") + format!("{err}") } else { self.to_string() }; diff --git a/src/server/mod.rs b/src/server/mod.rs index 3bdc3d8f..5b918e71 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -142,9 +142,7 @@ pub async fn run(app: Arc, config: ServerConfig, shutdown: Shutdown) -> any } #[derive(Clone)] -struct PanicHandler { - shutdown: Shutdown, -} +struct PanicHandler {} impl ResponseForPanic for PanicHandler { type ResponseBody = Body; @@ -154,7 +152,6 @@ impl ResponseForPanic for PanicHandler { error: Box, ) -> hyper::Response { tracing::error!(?error, "request panicked"); - self.shutdown.clone().shutdown(); hyper::Response::builder() .status(StatusCode::INTERNAL_SERVER_ERROR) .body(Body::empty()) @@ -162,12 +159,6 @@ impl ResponseForPanic for PanicHandler { } } -impl From for PanicHandler { - fn from(shutdown: Shutdown) -> Self { - Self { shutdown } - } -} - /// # Errors /// /// Will return `Err` if the provided `listener` address cannot be accessed or @@ -194,9 +185,7 @@ pub async fn bind_from_listener( .layer(middleware::from_fn( custom_middleware::api_metrics_layer::middleware, )) - .layer(CatchPanicLayer::custom(PanicHandler { - shutdown: shutdown.clone(), - })) + .layer(CatchPanicLayer::custom(PanicHandler {})) .layer(middleware::from_fn_with_state( serve_timeout, custom_middleware::timeout_layer::middleware,