From eedc536c23c3230c6ebeac8b495b2cfef0317830 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Tue, 23 Aug 2022 18:10:18 +0200 Subject: Auth login --- server/src/errors.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/src/errors.rs') 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!({ -- cgit v1.2.3-18-g5258