Skip to content

Commit 5289bd2

Browse files
committed
feat: add invalid file error code
1 parent ad3794b commit 5289bd2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

workflowai/core/domain/errors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"internal_error",
5353
# The request was invalid
5454
"bad_request",
55+
"invalid_file",
5556
],
5657
str, # Using as a fallback to avoid validation error if an error code is added to the API
5758
]
@@ -82,18 +83,18 @@ def __str__(self):
8283
def from_response(cls, response: Response):
8384
try:
8485
response_json = response.json()
85-
r_error = response_json.get("error",{})
86+
r_error = response_json.get("error", {})
8687
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", {})
8889
error_code = r_error.get("code", "unknown_error")
8990
status_code = response.status_code
9091
task_run_id = r_error.get("task_run_id", None)
9192
except JSONDecodeError:
9293
error_message = "Unknown error"
9394
details = {"raw": response.content.decode()}
94-
error_code ="unknown_error"
95+
error_code = "unknown_error"
9596
status_code = response.status_code
96-
task_run_id=None
97+
task_run_id = None
9798

9899
return cls(
99100
response=response,
@@ -105,4 +106,3 @@ def from_response(cls, response: Response):
105106
),
106107
task_run_id=task_run_id,
107108
)
108-

0 commit comments

Comments
 (0)