style: cargo fmt --all
This commit is contained in:
@@ -1,11 +1,17 @@
|
||||
use axum::{http::StatusCode, response::{IntoResponse, Response}, Json};
|
||||
use axum::{
|
||||
Json,
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use domain::errors::DomainError;
|
||||
use serde_json::json;
|
||||
|
||||
pub struct AppError(DomainError);
|
||||
|
||||
impl From<DomainError> for AppError {
|
||||
fn from(e: DomainError) -> Self { Self(e) }
|
||||
fn from(e: DomainError) -> Self {
|
||||
Self(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoResponse for AppError {
|
||||
@@ -19,7 +25,10 @@ impl IntoResponse for AppError {
|
||||
DomainError::QuotaExceeded(msg) => (StatusCode::PAYLOAD_TOO_LARGE, msg.clone()),
|
||||
DomainError::Internal(msg) => {
|
||||
tracing::error!("Internal error: {msg}");
|
||||
(StatusCode::INTERNAL_SERVER_ERROR, "Internal server error".to_string())
|
||||
(
|
||||
StatusCode::INTERNAL_SERVER_ERROR,
|
||||
"Internal server error".to_string(),
|
||||
)
|
||||
}
|
||||
};
|
||||
(status, Json(json!({ "error": message }))).into_response()
|
||||
|
||||
Reference in New Issue
Block a user