diff options
Diffstat (limited to 'server/src/errors.rs')
-rw-r--r-- | server/src/errors.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/src/errors.rs b/server/src/errors.rs index dc0468e..9221fea 100644 --- a/server/src/errors.rs +++ b/server/src/errors.rs @@ -8,6 +8,7 @@ use serde_json::json; pub enum AppError { Generic, Database, + BadRequest(String), } impl IntoResponse for AppError { @@ -15,12 +16,13 @@ impl IntoResponse for AppError { let (status, error_message) = match self { AppError::Generic => ( StatusCode::INTERNAL_SERVER_ERROR, - "Generic error, can't find why", + "Generic error, can't find why".to_string(), ), AppError::Database => ( StatusCode::INTERNAL_SERVER_ERROR, - "Error with database connection", + "Error with database connection".to_string(), ), + AppError::BadRequest(value) => (StatusCode::BAD_REQUEST, value), }; let body = Json(json!({ |