summaryrefslogtreecommitdiff
path: root/server/src/errors.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/errors.rs')
-rw-r--r--server/src/errors.rs10
1 files changed, 2 insertions, 8 deletions
diff --git a/server/src/errors.rs b/server/src/errors.rs
index e541eda..72eb837 100644
--- a/server/src/errors.rs
+++ b/server/src/errors.rs
@@ -7,14 +7,12 @@ use serde_json::json;
/// All errors raised by the web app
pub enum AppError {
- /// Generic error, never called yet
- Generic,
/// Database error
Database,
/// Generic bad request. It is handled with a message value
BadRequest(String),
/// Not found error
- NotFound,
+ NotFound(String),
/// Raised when a token is not good created
TokenCreation,
/// Raised when a passed token is not valid
@@ -30,16 +28,12 @@ impl IntoResponse for AppError {
/// ```
fn into_response(self) -> Response {
let (status, error_message) = match self {
- AppError::Generic => (
- StatusCode::INTERNAL_SERVER_ERROR,
- "Generic error, can't find why".to_string(),
- ),
AppError::Database => (
StatusCode::INTERNAL_SERVER_ERROR,
"Error with database connection".to_string(),
),
AppError::BadRequest(value) => (StatusCode::BAD_REQUEST, value),
- AppError::NotFound => (StatusCode::NOT_FOUND, "Element not found".to_string()),
+ AppError::NotFound(value) => (StatusCode::NOT_FOUND, value),
AppError::TokenCreation => (
StatusCode::INTERNAL_SERVER_ERROR,
"Token creation error".to_string(),