diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-03 10:09:52 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-03 10:09:52 +0000 |
| commit | 6cda1b704d1c38fc116e59a2a206c2adebfb6d4d (patch) | |
| tree | c4e18bd2ba164f5205d5faa08bac60a33a92f891 | |
| parent | 323822a100640fe85a61d3f806fc96fb62143a35 (diff) | |
`NotFound` error has now a string value
| -rw-r--r-- | src/errors.rs | 4 |
1 files changed, 2 insertions, 2 deletions
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(), |
