This commit is contained in:
2025-11-10 23:06:53 +01:00
parent 8dddb0b940
commit 8788cd3e25
11 changed files with 1336 additions and 1177 deletions
+4 -3
View File
@@ -6,6 +6,7 @@ use axum::{
use serde::Serialize;
use serde_json::Value;
use std::fmt::Display;
use utoipa::ToSchema;
pub type AppResult<T> = Result<T, AppError>;
@@ -61,7 +62,7 @@ impl AppError {
impl IntoResponse for AppError {
fn into_response(self) -> Response {
let status = self.status;
let body = Json(ErrorResponse {
let body = Json(ApiErrorResponse {
error: self.message,
code: self.code,
details: self.details,
@@ -70,8 +71,8 @@ impl IntoResponse for AppError {
}
}
#[derive(Serialize)]
struct ErrorResponse {
#[derive(Serialize, ToSchema)]
pub struct ApiErrorResponse {
error: String,
#[serde(skip_serializing_if = "Option::is_none")]
code: Option<String>,