File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -727,10 +727,13 @@ impl<T> CacheInfo<T> {
727
727
728
728
impl IntoResponse for Error {
729
729
fn into_response ( self ) -> axum:: response:: Response {
730
- Json ( ErrorJson {
731
- error : self . to_string ( ) ,
732
- } )
733
- . into_response ( )
730
+ let error = snafu:: CleanedErrorText :: new ( & self )
731
+ . map ( |( _, s, _) | s)
732
+ . reduce ( |l, r| l + ": " + & r)
733
+ . unwrap_or_default ( ) ;
734
+ let resp = Json ( ErrorJson { error } ) ;
735
+ let resp = ( StatusCode :: INTERNAL_SERVER_ERROR , resp) ;
736
+ resp. into_response ( )
734
737
}
735
738
}
736
739
@@ -754,7 +757,9 @@ where
754
757
Ok ( v) => Ok ( Self ( v. 0 ) ) ,
755
758
Err ( e) => {
756
759
let error = format ! ( "Unable to deserialize request: {e}" ) ;
757
- Err ( axum:: Json ( ErrorJson { error } ) . into_response ( ) )
760
+ let resp = axum:: Json ( ErrorJson { error } ) ;
761
+ let resp = ( StatusCode :: BAD_REQUEST , resp) ;
762
+ Err ( resp. into_response ( ) )
758
763
}
759
764
}
760
765
}
You can’t perform that action at this time.
0 commit comments