use axum::{ http::StatusCode, response::{IntoResponse, Response}, }; use tracing::error; /// App error for conversion to anyhow error. pub struct AppError(anyhow::Error); impl IntoResponse for AppError { fn into_response(self) -> Response { // Log error. error!("{:?}", self.0); StatusCode::BAD_REQUEST.into_response() } } impl From for AppError { fn from(err: anyhow::Error) -> Self { Self(err) } }