Skip to content

Commit 9ad5ce3

Browse files
[AC-242] Add error message detail to the LabelboxError when data row uploads fail.
1 parent 724dd58 commit 9ad5ce3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

labelbox/client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,13 @@ def upload_data(self,
381381
"Failed to upload, unknown cause", e)
382382

383383
if not file_data or not file_data.get("uploadFile", None):
384+
try:
385+
errors = response.json().get("errors", [])
386+
error_msg = next(iter(errors), {}).get("message", "Unknown error")
387+
except Exception as e:
388+
error_msg = "Unknown error"
384389
raise labelbox.exceptions.LabelboxError(
385-
"Failed to upload, message: %s" % file_data or
386-
file_data.get("error"))
390+
"Failed to upload, message: %s" % error_msg)
387391

388392
return file_data["uploadFile"]["url"]
389393

0 commit comments

Comments
 (0)