From 6cda1b704d1c38fc116e59a2a206c2adebfb6d4d Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 3 Sep 2022 12:09:52 +0200 Subject: `NotFound` error has now a string value --- src/errors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/errors.rs') diff --git a/src/errors.rs b/src/errors.rs index 1ce4502..72eb837 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -12,7 +12,7 @@ pub enum AppError { /// 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 @@ -33,7 +33,7 @@ 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::NotFound(value) => (StatusCode::NOT_FOUND, value), AppError::TokenCreation => ( StatusCode::INTERNAL_SERVER_ERROR, "Token creation error".to_string(), -- cgit v1.2.3-71-g8e6c