@@ -13,7 +13,7 @@ use axum::{
13
13
response:: { Html , IntoResponse , Response } ,
14
14
} ;
15
15
use hyper:: StatusCode ;
16
- use mas_axum_utils:: { cookies:: CookieJar , record_error } ;
16
+ use mas_axum_utils:: { GenericError , InternalError , cookies:: CookieJar } ;
17
17
use mas_data_model:: { UpstreamOAuthProvider , UpstreamOAuthProviderResponseMode } ;
18
18
use mas_jose:: claims:: TokenHash ;
19
19
use mas_keystore:: { Encrypter , Keystore } ;
@@ -153,15 +153,13 @@ impl_from_error_for_route!(super::cookie::UpstreamSessionNotFound);
153
153
154
154
impl IntoResponse for RouteError {
155
155
fn into_response ( self ) -> axum:: response:: Response {
156
- let sentry_event_id = record_error ! ( self , Self :: Internal ( _) ) ;
157
- let response = match self {
158
- Self :: ProviderNotFound => ( StatusCode :: NOT_FOUND , "Provider not found" ) . into_response ( ) ,
159
- Self :: SessionNotFound => ( StatusCode :: NOT_FOUND , "Session not found" ) . into_response ( ) ,
160
- Self :: Internal ( e) => ( StatusCode :: INTERNAL_SERVER_ERROR , e. to_string ( ) ) . into_response ( ) ,
161
- e => ( StatusCode :: BAD_REQUEST , e. to_string ( ) ) . into_response ( ) ,
162
- } ;
163
-
164
- ( sentry_event_id, response) . into_response ( )
156
+ match self {
157
+ Self :: Internal ( e) => InternalError :: new ( e) . into_response ( ) ,
158
+ e @ ( Self :: ProviderNotFound | Self :: SessionNotFound ) => {
159
+ GenericError :: new ( StatusCode :: NOT_FOUND , e) . into_response ( )
160
+ }
161
+ e => GenericError :: new ( StatusCode :: BAD_REQUEST , e) . into_response ( ) ,
162
+ }
165
163
}
166
164
}
167
165
0 commit comments