@@ -9,7 +9,7 @@ use axum::{
9
9
response:: { IntoResponse , Response } ,
10
10
} ;
11
11
use hyper:: StatusCode ;
12
- use mas_axum_utils:: { SessionInfoExt , cookies:: CookieJar , record_error } ;
12
+ use mas_axum_utils:: { GenericError , InternalError , SessionInfoExt , cookies:: CookieJar } ;
13
13
use mas_data_model:: { AuthorizationCode , Pkce } ;
14
14
use mas_router:: { PostAuthAction , UrlBuilder } ;
15
15
use mas_storage:: {
@@ -53,29 +53,15 @@ pub enum RouteError {
53
53
54
54
impl IntoResponse for RouteError {
55
55
fn into_response ( self ) -> axum:: response:: Response {
56
- let sentry_event_id = record_error ! ( self , Self :: Internal ( _) ) ;
57
- // TODO: better error pages
58
- let response = match self {
59
- RouteError :: Internal ( e) => {
60
- ( StatusCode :: INTERNAL_SERVER_ERROR , e. to_string ( ) ) . into_response ( )
56
+ match self {
57
+ Self :: Internal ( e) => InternalError :: new ( e) . into_response ( ) ,
58
+ e @ ( Self :: ClientNotFound
59
+ | Self :: InvalidResponseMode
60
+ | Self :: IntoCallbackDestination ( _)
61
+ | Self :: UnknownRedirectUri ( _) ) => {
62
+ GenericError :: new ( StatusCode :: BAD_REQUEST , e) . into_response ( )
61
63
}
62
- RouteError :: ClientNotFound => {
63
- ( StatusCode :: BAD_REQUEST , "could not find client" ) . into_response ( )
64
- }
65
- RouteError :: InvalidResponseMode => {
66
- ( StatusCode :: BAD_REQUEST , "invalid response mode" ) . into_response ( )
67
- }
68
- RouteError :: IntoCallbackDestination ( e) => {
69
- ( StatusCode :: BAD_REQUEST , e. to_string ( ) ) . into_response ( )
70
- }
71
- RouteError :: UnknownRedirectUri ( e) => (
72
- StatusCode :: BAD_REQUEST ,
73
- format ! ( "Invalid redirect URI ({e})" ) ,
74
- )
75
- . into_response ( ) ,
76
- } ;
77
-
78
- ( sentry_event_id, response) . into_response ( )
64
+ }
79
65
}
80
66
}
81
67
0 commit comments