Skip to content

Commit 7195550

Browse files
author
Richard Sun
committed
[QQC-1484] Surface errors for Move data rows to step task
1 parent 41a6448 commit 7195550

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

labelbox/schema/task.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23
import requests
34
import time
@@ -83,9 +84,16 @@ def wait_till_done(self, timeout_seconds: int = 300) -> None:
8384
def errors(self) -> Optional[Dict[str, Any]]:
8485
""" Fetch the error associated with an import task.
8586
"""
87+
if self.type == "add-data-rows-to-batch" or self.type == "send-to-task-queue":
88+
if self.status == "FAILED":
89+
# for these tasks, the error is embedded in the result itself
90+
return json.loads(self.result_url)
91+
return None
92+
8693
# TODO: We should handle error messages for export v2 tasks in the future.
8794
if self.name != 'JSON Import':
8895
return None
96+
8997
if self.status == "FAILED":
9098
result = self._fetch_remote_json()
9199
return result["error"]

0 commit comments

Comments
 (0)