Document errors

This commit is contained in:
Mo 2023-02-23 17:12:59 +01:00
parent 7992857e5f
commit 95c71a2ed5

View file

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