diff options
author | Santo Cariotti <santo@dcariotti.me> | 2022-08-23 18:10:18 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2022-08-23 18:10:18 +0200 |
commit | eedc536c23c3230c6ebeac8b495b2cfef0317830 (patch) | |
tree | 198007257cfa195c410c28b0a576f46fb8870ab9 /server/src/errors.rs | |
parent | 0dace9fb82953cc91e6d603c4c9970631ac036ad (diff) |
Auth login
Diffstat (limited to 'server/src/errors.rs')
-rw-r--r-- | server/src/errors.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/server/src/errors.rs b/server/src/errors.rs index 9221fea..d991132 100644 --- a/server/src/errors.rs +++ b/server/src/errors.rs @@ -9,6 +9,8 @@ pub enum AppError { Generic, Database, BadRequest(String), + NotFound, + TokenCreation, } impl IntoResponse for AppError { @@ -23,6 +25,11 @@ impl IntoResponse for AppError { "Error with database connection".to_string(), ), AppError::BadRequest(value) => (StatusCode::BAD_REQUEST, value), + AppError::NotFound => (StatusCode::NOT_FOUND, "Element not found".to_string()), + AppError::TokenCreation => ( + StatusCode::INTERNAL_SERVER_ERROR, + "Token creation error".to_string(), + ), }; let body = Json(json!({ |