File tree 2 files changed +3
-3
lines changed
2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,7 @@ impl<C: Config> Client<C> {
231
231
if status. as_u16 ( ) == 429
232
232
// API returns 429 also when:
233
233
// "You exceeded your current quota, please check your plan and billing details."
234
- && wrapped_error. error . r#type != "insufficient_quota"
234
+ && wrapped_error. error . r#type != Some ( "insufficient_quota" . to_string ( ) )
235
235
{
236
236
// Rate limited retry...
237
237
tracing:: warn!( "Rate limited: {}" , wrapped_error. error. message) ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ pub enum OpenAIError {
7
7
#[ error( "http error: {0}" ) ]
8
8
Reqwest ( #[ from] reqwest:: Error ) ,
9
9
/// OpenAI returns error object with details of API call failure
10
- #[ error( "{}: {}" , . 0 . r#type, . 0 . message) ]
10
+ #[ error( "{:? }: {}" , . 0 . r#type, . 0 . message) ]
11
11
ApiError ( ApiError ) ,
12
12
/// Error when a response cannot be deserialized into a Rust type
13
13
#[ error( "failed to deserialize api response: {0}" ) ]
@@ -31,7 +31,7 @@ pub enum OpenAIError {
31
31
#[ derive( Debug , Deserialize ) ]
32
32
pub struct ApiError {
33
33
pub message : String ,
34
- pub r#type : String ,
34
+ pub r#type : Option < String > ,
35
35
pub param : Option < serde_json:: Value > ,
36
36
pub code : Option < serde_json:: Value > ,
37
37
}
You can’t perform that action at this time.
0 commit comments