feat: implement conversion from DbErr to ApiError
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
use axum::response::IntoResponse;
|
use axum::response::IntoResponse;
|
||||||
|
use sea_orm::DbErr;
|
||||||
|
|
||||||
use crate::errors::service_error::ServiceError;
|
use crate::errors::service_error::ServiceError;
|
||||||
|
|
||||||
@@ -12,6 +13,12 @@ impl From<ServiceError> for ApiError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<DbErr> for ApiError {
|
||||||
|
fn from(err: DbErr) -> Self {
|
||||||
|
ServiceError::from(err).into()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl IntoResponse for ApiError {
|
impl IntoResponse for ApiError {
|
||||||
fn into_response(self) -> axum::response::Response {
|
fn into_response(self) -> axum::response::Response {
|
||||||
match self {
|
match self {
|
||||||
|
|||||||
Reference in New Issue
Block a user