mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-13 19:22:26 +00:00
31 lines
881 B
Rust
31 lines
881 B
Rust
use axum::http::StatusCode;
|
|
use axum::response::IntoResponse;
|
|
use openidconnect::{ClaimsVerificationError, ConfigurationError, url::ParseError};
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum OidcError {
|
|
#[error("Cannot generate redirect url, something's not configured correctly")]
|
|
OidcParseError(#[from] ParseError),
|
|
|
|
#[error("Error fetching user info: {0}")]
|
|
UserInfo(String),
|
|
|
|
#[error(transparent)]
|
|
OidcConfigurationError(#[from] ConfigurationError),
|
|
|
|
#[error(transparent)]
|
|
OidcClaimsVerificationError(#[from] ClaimsVerificationError),
|
|
|
|
#[error(transparent)]
|
|
SessionError(#[from] tower_sessions::session::Error),
|
|
|
|
#[error("{0}")]
|
|
Other(&'static str),
|
|
}
|
|
|
|
impl IntoResponse for OidcError {
|
|
fn into_response(self) -> axum::response::Response {
|
|
(StatusCode::INTERNAL_SERVER_ERROR, self.to_string()).into_response()
|
|
}
|
|
}
|