File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed
Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -128,15 +128,26 @@ fn zstd_decompress(data: &[u8]) -> Result<Vec<u8>, AppError> {
128128 Ok ( out)
129129}
130130
131- fn s3_error ( error : impl ToString ) -> AppError {
132- AppError :: S3 ( error. to_string ( ) )
131+ fn s3_error ( error : impl ToString + std:: fmt:: Debug ) -> AppError {
132+ let display = error. to_string ( ) ;
133+ let debug = format ! ( "{error:?}" ) ;
134+ if display == debug {
135+ AppError :: S3 ( display)
136+ } else {
137+ AppError :: S3 ( format ! ( "{display}; details: {debug}" ) )
138+ }
133139}
134140
135- fn s3_get_error ( error : impl ToString ) -> AppError {
141+ fn s3_get_error ( error : impl ToString + std :: fmt :: Debug ) -> AppError {
136142 let msg = error. to_string ( ) ;
137- if msg. contains ( "NoSuchKey" ) || msg. contains ( "not found" ) {
143+ let details = format ! ( "{error:?}" ) ;
144+ if msg. contains ( "NoSuchKey" )
145+ || msg. contains ( "not found" )
146+ || details. contains ( "NoSuchKey" )
147+ || details. contains ( "NotFound" )
148+ {
138149 AppError :: NotFound
139150 } else {
140- AppError :: S3 ( msg)
151+ AppError :: S3 ( format ! ( "{ msg}; details: {details}" ) )
141152 }
142153}
You can’t perform that action at this time.
0 commit comments