refactor(core): add ImageProcessingFailed error

This commit is contained in:
Paul Makles
2024-10-02 14:12:26 +01:00
parent bb202079e0
commit f31020fb6e
5 changed files with 16 additions and 12 deletions

View File

@@ -1,4 +1,5 @@
use axum::{http::StatusCode, response::IntoResponse, Json};
use rocket::http::Status;
use crate::{Error, ErrorType};
@@ -78,6 +79,7 @@ impl IntoResponse for Error {
ErrorType::FileTooSmall => StatusCode::UNPROCESSABLE_ENTITY,
ErrorType::FileTooLarge { .. } => StatusCode::UNPROCESSABLE_ENTITY,
ErrorType::FileTypeNotAllowed => StatusCode::BAD_REQUEST,
ErrorType::ImageProcessingFailed => StatusCode::INTERNAL_SERVER_ERROR,
};
(status, Json(&self)).into_response()