Skip to content

Commit 0b583b6

Browse files
committed
Human-readable error page on the compat SSO login redirect
1 parent e3dd047 commit 0b583b6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/handlers/src/compat/login_sso_redirect.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use axum::{
99
response::IntoResponse,
1010
};
1111
use hyper::StatusCode;
12-
use mas_axum_utils::record_error;
12+
use mas_axum_utils::{GenericError, InternalError};
1313
use mas_router::{CompatLoginSsoAction, CompatLoginSsoComplete, UrlBuilder};
1414
use mas_storage::{BoxClock, BoxRepository, BoxRng, compat::CompatSsoLoginRepository};
1515
use rand::distributions::{Alphanumeric, DistString};
@@ -43,12 +43,12 @@ impl_from_error_for_route!(mas_storage::RepositoryError);
4343

4444
impl IntoResponse for RouteError {
4545
fn into_response(self) -> axum::response::Response {
46-
let sentry_event_id = record_error!(self, Self::Internal(_));
47-
let status_code = match &self {
48-
Self::Internal(_) => StatusCode::INTERNAL_SERVER_ERROR,
49-
Self::MissingRedirectUrl | Self::InvalidRedirectUrl => StatusCode::BAD_REQUEST,
50-
};
51-
(status_code, sentry_event_id, format!("{self}")).into_response()
46+
match self {
47+
Self::Internal(e) => InternalError::new(e).into_response(),
48+
Self::MissingRedirectUrl | Self::InvalidRedirectUrl => {
49+
GenericError::new(StatusCode::BAD_REQUEST, self).into_response()
50+
}
51+
}
5252
}
5353
}
5454

0 commit comments

Comments
 (0)