diff options
Diffstat (limited to 'src/routes/errors.rs')
| -rw-r--r-- | src/routes/errors.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/routes/errors.rs b/src/routes/errors.rs index 6261d75..78b4e3a 100644 --- a/src/routes/errors.rs +++ b/src/routes/errors.rs @@ -5,6 +5,8 @@ pub enum RouteError { Internal(String), UserCreateEmailExists(String), UserCreateUsernameExists(String), + UnregisteredEmail(String), + AuthorizationFailure(), } impl IntoResponse for RouteError { @@ -18,6 +20,12 @@ impl IntoResponse for RouteError { }, RouteError::UserCreateUsernameExists(username) => { (StatusCode::BAD_REQUEST, format!("user with username \"{}\" already exists", username)) + }, + RouteError::UnregisteredEmail(email) => { + (StatusCode::BAD_REQUEST, format!("email \"{}\" is not registered", email)) + }, + RouteError::AuthorizationFailure() => { + (StatusCode::UNAUTHORIZED, format!("failed to authorize")) } }; |
