use axum::{ http::StatusCode, response::{IntoResponse, Response}, }; #[derive(Debug)] pub struct AppError(anyhow::Error); impl IntoResponse for AppError { fn into_response(self) -> Response { ( StatusCode::INTERNAL_SERVER_ERROR, format!("Something went wrong: {}", self.0), ) .into_response() } } impl From for AppError where E: Into, { fn from(err: E) -> Self { Self(err.into()) } }