Skip to content
Clone
1480255
25 lines 700 B Rust
#[derive(Debug, thiserror::Error)]
pub enum KenAuthError {
#[error("kenoauth is unavailable: {0}")]
Unavailable(String),
#[error("kenoauth rejected the request: {0}")]
Rejected(String),
#[error("kenoauth could not find the requested object")]
NotFound,
#[error("kenoauth rejected the credential")]
Unauthenticated,
#[error("kenoauth configuration is invalid: {0}")]
Config(String),
#[error("kenoauth request failed: {0}")]
Internal(String),
}
impl KenAuthError {
pub fn is_not_found(&self) -> bool {
matches!(self, Self::NotFound)
}
pub fn is_unauthenticated(&self) -> bool {
matches!(self, Self::Unauthenticated)
}
}