We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c27e964 commit 8b81372Copy full SHA for 8b81372
async-openai/src/client.rs
@@ -232,8 +232,8 @@ impl Client {
232
return Err(OpenAIError::ApiError(wrapped_error.error));
233
}
234
235
- let response: O =
236
- serde_json::from_slice(bytes.as_ref()).map_err(OpenAIError::JSONDeserialize)?;
+ let response: O = serde_json::from_slice(bytes.as_ref())
+ .map_err(|e| map_deserialization_error(e, bytes.as_ref()))?;
237
Ok(response)
238
239
@@ -369,7 +369,9 @@ impl Client {
369
370
371
let response = match serde_json::from_str::<O>(&message.data) {
372
- Err(e) => Err(OpenAIError::JSONDeserialize(e)),
+ Err(e) => {
373
+ Err(map_deserialization_error(e, &message.data.as_bytes()))
374
+ }
375
Ok(output) => Ok(output),
376
};
377
0 commit comments