File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 52
52
"internal_error" ,
53
53
# The request was invalid
54
54
"bad_request" ,
55
+ "invalid_file" ,
55
56
],
56
57
str , # Using as a fallback to avoid validation error if an error code is added to the API
57
58
]
@@ -82,18 +83,18 @@ def __str__(self):
82
83
def from_response (cls , response : Response ):
83
84
try :
84
85
response_json = response .json ()
85
- r_error = response_json .get ("error" ,{})
86
+ r_error = response_json .get ("error" , {})
86
87
error_message = response_json .get ("detail" , {}) or r_error .get ("message" , "Unknown Error" )
87
- details = r_error .get ("details" , {})
88
+ details = r_error .get ("details" , {})
88
89
error_code = r_error .get ("code" , "unknown_error" )
89
90
status_code = response .status_code
90
91
task_run_id = r_error .get ("task_run_id" , None )
91
92
except JSONDecodeError :
92
93
error_message = "Unknown error"
93
94
details = {"raw" : response .content .decode ()}
94
- error_code = "unknown_error"
95
+ error_code = "unknown_error"
95
96
status_code = response .status_code
96
- task_run_id = None
97
+ task_run_id = None
97
98
98
99
return cls (
99
100
response = response ,
@@ -105,4 +106,3 @@ def from_response(cls, response: Response):
105
106
),
106
107
task_run_id = task_run_id ,
107
108
)
108
-
You can’t perform that action at this time.
0 commit comments