Skip to content

Commit daca2e7

Browse files
author
Val Brodsky
committed
Do not retry 422 errors
1 parent 6096bdf commit daca2e7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

libs/labelbox/src/labelbox/client.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,10 @@ def get_error_status_code(error: dict) -> int:
310310
if internal_server_error is not None:
311311
message = internal_server_error.get("message")
312312
error_status_code = get_error_status_code(internal_server_error)
313-
314313
if error_status_code == 400:
315314
raise labelbox.exceptions.InvalidQueryError(message)
315+
elif error_status_code == 422:
316+
raise labelbox.exceptions.UnprocessableEntityError(message)
316317
elif error_status_code == 426:
317318
raise labelbox.exceptions.OperationNotAllowedException(message)
318319
elif error_status_code == 500:
@@ -853,8 +854,8 @@ def create_model_evaluation_project(self,
853854
>>> client.create_model_evaluation_project(name=project_name, dataset_id="clr00u8j0j0j0")
854855
>>> This creates a new project, and adds 100 datarows to the dataset with id "clr00u8j0j0j0" and assigns a batch of the newly created data rows to the project.
855856
856-
>>> client.create_model_evaluation_project(name=project_name, dataset_id="clr00u8j0j0j0", data_row_count=0)
857-
>>> This creates a new project, and adds 100 datarows to the dataset with id "clr00u8j0j0j0" and assigns a batch of the newly created data rows to the project.
857+
>>> client.create_model_evaluation_project(name=project_name, dataset_id="clr00u8j0j0j0", data_row_count=10)
858+
>>> This creates a new project, and adds 100 datarows to the dataset with id "clr00u8j0j0j0" and assigns a batch of the newly created 10 data rows to the project.
858859
859860
860861
"""

libs/labelbox/src/labelbox/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ class InvalidQueryError(LabelboxError):
7171
pass
7272

7373

74+
class UnprocessableEntityError(LabelboxError):
75+
""" Indicates that a resource could not be created in the server side
76+
due to a validation or transaction error"""
77+
pass
78+
79+
7480
class ResourceCreationError(LabelboxError):
7581
""" Indicates that a resource could not be created in the server side
7682
due to a validation or transaction error"""

0 commit comments

Comments
 (0)