Add Unauthorized error

This commit is contained in:
2026-06-27 22:33:50 -04:00
parent 7ca7056fac
commit d028636e43

View File

@@ -239,7 +239,9 @@ impl From<ServerFnError> 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,
}