feat: introduce ApiError for improved error handling in upstream routes

This commit is contained in:
GW_MC
2025-12-29 18:03:09 +08:00
parent abeea4fad7
commit fdfd1c98e0
4 changed files with 26 additions and 4 deletions

View File

@@ -0,0 +1,21 @@
use axum::response::IntoResponse;
use crate::errors::service_error::ServiceError;
pub enum ApiError {
ServiceError(ServiceError),
}
impl From<ServiceError> for ApiError {
fn from(err: ServiceError) -> Self {
ApiError::ServiceError(err)
}
}
impl IntoResponse for ApiError {
fn into_response(self) -> axum::response::Response {
match self {
ApiError::ServiceError(service_error) => service_error.into_response(),
}
}
}