Skip to content

Commit 96fd24e

Browse files
author
Kevin Kim
committed
Modify error message to be clearer
1 parent 10bad16 commit 96fd24e

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

labelbox/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1116,7 +1116,9 @@ def _format_failed_rows(rows: Dict[str, str],
11161116
errors.extend(
11171117
_format_failed_rows(
11181118
rows=res['invalidGlobalKeyAssignments'],
1119-
error_msg="Invalid Data Row or invalid global key"))
1119+
error_msg=
1120+
"Invalid assignment. Either DataRow does not exist, or globalKey is invalid"
1121+
))
11201122
errors.extend(
11211123
_format_failed_rows(rows=res['accessDeniedAssignments'],
11221124
error_msg="Access denied to Data Row"))

tests/integration/test_global_keys.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def test_assign_same_global_keys_to_data_rows(client, dataset, image_url):
7575
assert len(res['errors']) == 1
7676
assert res['errors'][0]['data_row_id'] == dr_2.uid
7777
assert res['errors'][0]['global_key'] == gk_1
78-
assert res['errors'][0]['error'] == "Invalid Data Row or invalid global key"
78+
assert res['errors'][0][
79+
'error'] == "Invalid assignment. Either DataRow does not exist, or globalKey is invalid"
7980

8081

8182
def test_global_key_sanitization(dataset, image_url):
@@ -144,9 +145,9 @@ def test_global_key_with_whitespaces_validation(client, dataset, image_url):
144145
assert assign_errors_ids == set([dr_1.uid, dr_2.uid, dr_3.uid])
145146
assert assign_errors_gks == set([gk_1, gk_2, gk_3])
146147
assert assign_errors_msgs == set([
147-
'Invalid Data Row or invalid global key',
148-
'Invalid Data Row or invalid global key',
149-
'Invalid Data Row or invalid global key'
148+
'Invalid assignment. Either DataRow does not exist, or globalKey is invalid',
149+
'Invalid assignment. Either DataRow does not exist, or globalKey is invalid',
150+
'Invalid assignment. Either DataRow does not exist, or globalKey is invalid'
150151
])
151152

152153

0 commit comments

Comments
 (0)