contact-form/src/errors.rs

19 lines
404 B
Rust

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