Skip to content

Commit a8217b2

Browse files
[SDK-448] Default to 500 error if a server error is unparseable instead of throwing an exception. (#1410)
1 parent 0a2507f commit a8217b2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

labelbox/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,11 @@ def check_errors(keywords, *path):
235235
return error
236236
return None
237237

238-
def get_error_status_code(error):
239-
return error["extensions"].get("exception").get("status")
238+
def get_error_status_code(error: dict) -> int:
239+
try:
240+
return int(error["extensions"].get("exception").get("status"))
241+
except:
242+
return 500
240243

241244
if check_errors(["AUTHENTICATION_ERROR"], "extensions",
242245
"code") is not None:

0 commit comments

Comments
 (0)