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.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/server/src/error.rs b/server/src/error.rs
index aef2687..9d82a54 100644
--- a/server/src/error.rs
+++ b/server/src/error.rs
@@ -1,4 +1,7 @@
-use axum::{http::{StatusCode, self}, response::IntoResponse};
+use axum::{
+ http::{self, StatusCode},
+ response::IntoResponse,
+};
use openidconnect::{core::CoreErrorResponseType, ClaimsVerificationError, StandardErrorResponse};
use tracing::error;
@@ -47,13 +50,18 @@ pub enum BridgeError {
impl BridgeError {
pub fn as_rejection(&self) -> (http::StatusCode, String) {
- (StatusCode::INTERNAL_SERVER_ERROR, format!("Error: {self}"))
+ match self {
+ BridgeError::OpenidRequestTokenError(_) => {
+ (StatusCode::UNAUTHORIZED, format!("Error fetching token"))
+ }
+ _ => (StatusCode::INTERNAL_SERVER_ERROR, format!("Error: {self}")),
+ }
}
}
impl IntoResponse for BridgeError {
fn into_response(self) -> axum::response::Response {
error!("Error occurred: {self:?}");
- self.as_rejection().into_response()
+ self.as_rejection().into_response()
}
}