Skip to content

Commit 4a6aabe

Browse files
authored
Merge pull request #124 from Labelbox/ms/update-error-check
catches errors properly
2 parents b1c2ac3 + ed40128 commit 4a6aabe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

labelbox/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def check_errors(keywords, *path):
161161
return error
162162
return None
163163

164-
if check_errors(["AUTHENTICATION_ERROR"], "extensions", "exception",
164+
if check_errors(["AUTHENTICATION_ERROR"], "extensions",
165165
"code") is not None:
166166
raise labelbox.exceptions.AuthenticationError("Invalid API key")
167167

@@ -173,6 +173,7 @@ def check_errors(keywords, *path):
173173

174174
validation_error = check_errors(["GRAPHQL_VALIDATION_FAILED"],
175175
"extensions", "code")
176+
176177
if validation_error is not None:
177178
message = validation_error["message"]
178179
if message == "Query complexity limit exceeded":
@@ -193,8 +194,7 @@ def check_errors(keywords, *path):
193194
raise labelbox.exceptions.ApiLimitError(response_msg)
194195

195196
resource_not_found_error = check_errors(["RESOURCE_NOT_FOUND"],
196-
"extensions", "exception",
197-
"code")
197+
"extensions", "code")
198198
if resource_not_found_error is not None:
199199
# Return None and let the caller methods raise an exception
200200
# as they already know which resource type and ID was requested

0 commit comments

Comments
 (0)