2022-11-01 19:45:06 +00:00
|
|
|
use axum::http::StatusCode;
|
|
|
|
use axum::response::{IntoResponse, Response};
|
|
|
|
|
|
|
|
pub struct AppError(anyhow::Error);
|
|
|
|
|
|
|
|
impl IntoResponse for AppError {
|
|
|
|
fn into_response(self) -> Response {
|
|
|
|
StatusCode::BAD_REQUEST.into_response()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl From<anyhow::Error> for AppError {
|
|
|
|
fn from(err: anyhow::Error) -> Self {
|
2022-11-01 23:24:17 +00:00
|
|
|
Self(err)
|
2022-11-01 19:45:06 +00:00
|
|
|
}
|
|
|
|
}
|