File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ pub enum OpenAIError {
1313 #[ error( "{0}" ) ]
1414 ApiError ( ApiError ) ,
1515 /// Error when a response cannot be deserialized into a Rust type
16- #[ error( "failed to deserialize api response: {0 }" ) ]
17- JSONDeserialize ( serde_json:: Error ) ,
16+ #[ error( "failed to deserialize api response: error:{0} content:{1 }" ) ]
17+ JSONDeserialize ( serde_json:: Error , String ) ,
1818 /// Error on the client side when saving file to file system
1919 #[ error( "failed to save file: {0}" ) ]
2020 FileSaveError ( String ) ,
@@ -81,9 +81,11 @@ pub struct WrappedError {
8181}
8282
8383pub ( crate ) fn map_deserialization_error ( e : serde_json:: Error , bytes : & [ u8 ] ) -> OpenAIError {
84+ let json_content = String :: from_utf8_lossy ( bytes) ;
8485 tracing:: error!(
8586 "failed deserialization of: {}" ,
86- String :: from_utf8_lossy ( bytes )
87+ json_content
8788 ) ;
88- OpenAIError :: JSONDeserialize ( e)
89+
90+ OpenAIError :: JSONDeserialize ( e, json_content. to_string ( ) )
8991}
You can’t perform that action at this time.
0 commit comments