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 @@ -10,8 +10,8 @@ pub enum OpenAIError {
1010 #[ error( "{0}" ) ]
1111 ApiError ( ApiError ) ,
1212 /// Error when a response cannot be deserialized into a Rust type
13- #[ error( "failed to deserialize api response: {0 }" ) ]
14- JSONDeserialize ( serde_json:: Error ) ,
13+ #[ error( "failed to deserialize api response: error:{0} content:{1 }" ) ]
14+ JSONDeserialize ( serde_json:: Error , String ) ,
1515 /// Error on the client side when saving file to file system
1616 #[ error( "failed to save file: {0}" ) ]
1717 FileSaveError ( String ) ,
@@ -78,9 +78,11 @@ pub struct WrappedError {
7878}
7979
8080pub ( crate ) fn map_deserialization_error ( e : serde_json:: Error , bytes : & [ u8 ] ) -> OpenAIError {
81+ let json_content = String :: from_utf8_lossy ( bytes) ;
8182 tracing:: error!(
8283 "failed deserialization of: {}" ,
83- String :: from_utf8_lossy ( bytes )
84+ json_content
8485 ) ;
85- OpenAIError :: JSONDeserialize ( e)
86+
87+ OpenAIError :: JSONDeserialize ( e, json_content. to_string ( ) )
8688}
You can’t perform that action at this time.
0 commit comments