File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
crates/handlers/src/oauth2/authorization Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ use axum::{
11
11
use axum_extra:: TypedHeader ;
12
12
use hyper:: StatusCode ;
13
13
use mas_axum_utils:: {
14
+ GenericError , InternalError ,
14
15
cookies:: CookieJar ,
15
16
csrf:: { CsrfExt , ProtectedForm } ,
16
- record_error,
17
17
} ;
18
18
use mas_data_model:: AuthorizationGrantStage ;
19
19
use mas_keystore:: Keystore ;
@@ -64,13 +64,15 @@ impl_from_error_for_route!(super::callback::CallbackDestinationError);
64
64
65
65
impl IntoResponse for RouteError {
66
66
fn into_response ( self ) -> axum:: response:: Response {
67
- let sentry_event_id = record_error ! ( self , Self :: Internal ( _) | Self :: NoSuchClient ( _) ) ;
68
- (
69
- StatusCode :: INTERNAL_SERVER_ERROR ,
70
- sentry_event_id,
71
- self . to_string ( ) ,
72
- )
73
- . into_response ( )
67
+ match self {
68
+ Self :: Internal ( e) => InternalError :: new ( e) . into_response ( ) ,
69
+ e @ Self :: NoSuchClient ( _) => InternalError :: new ( Box :: new ( e) ) . into_response ( ) ,
70
+ e @ Self :: GrantNotFound => GenericError :: new ( StatusCode :: NOT_FOUND , e) . into_response ( ) ,
71
+ e @ Self :: GrantNotPending ( _) => {
72
+ GenericError :: new ( StatusCode :: CONFLICT , e) . into_response ( )
73
+ }
74
+ e @ Self :: Csrf ( _) => GenericError :: new ( StatusCode :: BAD_REQUEST , e) . into_response ( ) ,
75
+ }
74
76
}
75
77
}
76
78
You can’t perform that action at this time.
0 commit comments