style: cargo fmt --all

This commit is contained in:
2026-05-31 05:31:42 +02:00
parent 4b31a0f74b
commit c2ebca0da0
138 changed files with 2422 additions and 1164 deletions

View File

@@ -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()