diff --git a/src/util/error.rs b/src/util/error.rs index c85d51e..4d91ecf 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -239,7 +239,9 @@ impl From for Error { impl dioxus_fullstack::AsStatusCode for Error { fn as_status_code(&self) -> StatusCode { match &self.source { - ErrorType::Auth(AuthError::InvalidCredentials) => StatusCode::UNAUTHORIZED, + ErrorType::Auth(AuthError::InvalidCredentials | AuthError::Unauthorized) => { + StatusCode::UNAUTHORIZED + } ErrorType::Database(msg) if *msg == (diesel::result::Error::NotFound).to_string() => { StatusCode::NOT_FOUND } @@ -343,4 +345,7 @@ pub enum AuthError { #[error("{0}")] Error(String), + + #[error("Unauthorized")] + Unauthorized, }