summaryrefslogtreecommitdiff
path: root/server/src/error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/error.rs')
-rw-r--r--server/src/error.rs28
1 files changed, 24 insertions, 4 deletions
diff --git a/server/src/error.rs b/server/src/error.rs
index 439e81b..1a45e96 100644
--- a/server/src/error.rs
+++ b/server/src/error.rs
@@ -1,5 +1,9 @@
use axum::{http::StatusCode, response::IntoResponse};
-use openidconnect::{core::CoreErrorResponseType, StandardErrorResponse, ClaimsVerificationError};
+use openidconnect::{core::CoreErrorResponseType, ClaimsVerificationError, StandardErrorResponse};
+use tracing::error;
+
+type UserInfoError =
+ openidconnect::UserInfoError<openidconnect::reqwest::Error<reqwest::Error>>;
type RequestTokenError = openidconnect::RequestTokenError<
openidconnect::reqwest::Error<reqwest::Error>,
@@ -11,18 +15,34 @@ pub enum BridgeError {
#[error("Invalid request: {0}")]
InvalidRequest(String),
- #[error("Backend request failed")]
- Backend(#[from] RequestTokenError),
+ #[error("Requesting token failed")]
+ OpenidRequestTokenError(#[from] RequestTokenError),
+
+ #[error("Requesting user info failed")]
+ OpenidUserInfoError(#[from] UserInfoError),
+
+ #[error("Failed to configure OpenId request")]
+ OpenIdConfigurationError(#[from] openidconnect::ConfigurationError),
#[error("Unexpected authorization error")]
UnexpectedInvalidAuthorization(#[from] ClaimsVerificationError),
-
+
+ #[error("Authentication error")]
+ SigningFailed(#[from] openidconnect::SigningError),
+
+ #[error("Database error")]
+ SqlxError(#[from] sqlx::Error),
+
+ #[error("Uuid parse failed")]
+ UuidError(#[from] uuid::Error),
+
#[error("Internal server error: {0}")]
Internal(String),
}
impl IntoResponse for BridgeError {
fn into_response(self) -> axum::response::Response {
+ error!("Error occurred: {self:?}");
(StatusCode::INTERNAL_SERVER_ERROR, format!("Error: {self}")).into_response()
}
}