feat: review cbr and unraring for image on api

This commit is contained in:
2026-03-07 15:47:46 +01:00
parent 162b4712e7
commit 360d6e85de
6 changed files with 85 additions and 93 deletions

View File

@@ -1,4 +1,8 @@
use axum::{http::StatusCode, response::{IntoResponse, Response}, Json};
use axum::{
http::StatusCode,
response::{IntoResponse, Response},
Json,
};
use serde::Serialize;
#[derive(Debug)]
@@ -51,7 +55,13 @@ impl ApiError {
impl IntoResponse for ApiError {
fn into_response(self) -> Response {
(self.status, Json(ErrorBody { error: &self.message })).into_response()
(
self.status,
Json(ErrorBody {
error: &self.message,
}),
)
.into_response()
}
}
@@ -60,3 +70,9 @@ impl From<sqlx::Error> for ApiError {
Self::internal(format!("database error: {err}"))
}
}
impl From<std::io::Error> for ApiError {
fn from(err: std::io::Error) -> Self {
Self::internal(format!("IO error: {err}"))
}
}