@@ -18,7 +18,7 @@ pub fn pack(err: anyhow::Error) -> Problem {
1818 match err {
1919 auth:: AuthError :: InvalidCredentials => {
2020 return Problem :: new ( "Invalid credentials." )
21- . set_status ( http:: StatusCode :: BAD_REQUEST )
21+ . set_status ( http:: StatusCode :: UNAUTHORIZED )
2222 . set_detail ( "The passed credentials were invalid." )
2323 }
2424 auth:: AuthError :: ArgonError => ( ) ,
@@ -60,17 +60,17 @@ pub async fn unpack(rejection: Rejection) -> Result<impl Reply, Infallible> {
6060 let reply = if rejection. is_not_found ( ) {
6161 let problem = Problem :: with_title_and_type_from_status ( http:: StatusCode :: NOT_FOUND ) ;
6262 reply_from_problem ( & problem)
63- } else if let Some ( _) = rejection. find :: < warp:: reject:: MethodNotAllowed > ( ) {
64- let problem =
65- Problem :: with_title_and_type_from_status ( http:: StatusCode :: METHOD_NOT_ALLOWED ) ;
66- reply_from_problem ( & problem)
6763 } else if let Some ( problem) = rejection. find :: < Problem > ( ) {
6864 reply_from_problem ( problem)
6965 } else if let Some ( e) = rejection. find :: < warp:: filters:: body:: BodyDeserializeError > ( ) {
7066 let problem = Problem :: new ( "Invalid Request Body." )
7167 . set_status ( http:: StatusCode :: BAD_REQUEST )
7268 . set_detail ( format ! ( "Request body is invalid. {}" , e) ) ;
7369 reply_from_problem ( & problem)
70+ } else if let Some ( _) = rejection. find :: < warp:: reject:: MethodNotAllowed > ( ) {
71+ let problem =
72+ Problem :: with_title_and_type_from_status ( http:: StatusCode :: METHOD_NOT_ALLOWED ) ;
73+ reply_from_problem ( & problem)
7474 } else {
7575 let problem =
7676 Problem :: with_title_and_type_from_status ( http:: StatusCode :: INTERNAL_SERVER_ERROR ) ;
0 commit comments