@@ -49,6 +49,10 @@ class Task(DbObject):
4949 created_by = Relationship .ToOne ("User" , False , "created_by" )
5050 organization = Relationship .ToOne ("Organization" )
5151
52+ # Import and upsert have several instances of special casing
53+ def is_creation_task (self ) -> bool :
54+ return self .name == 'JSON Import' or self .type == 'adv-upsert-data-rows'
55+
5256 def refresh (self ) -> None :
5357 """ Refreshes Task data from the server. """
5458 assert self ._user is not None
@@ -57,6 +61,8 @@ def refresh(self) -> None:
5761 raise ResourceNotFoundError (Task , self .uid )
5862 for field in self .fields ():
5963 setattr (self , field .name , getattr (tasks [0 ], field .name ))
64+ if self .is_creation_task ():
65+ self .errors_url = self .result_url
6066
6167 def wait_till_done (self ,
6268 timeout_seconds : float = 300.0 ,
@@ -90,7 +96,7 @@ def wait_till_done(self,
9096 def errors (self ) -> Optional [Dict [str , Any ]]:
9197 """ Fetch the error associated with an import task.
9298 """
93- if self .name == 'JSON Import' or self . type == 'adv-upsert-data-rows' :
99+ if self .is_creation_task () :
94100 if self .status == "FAILED" :
95101 result = self ._fetch_remote_json ()
96102 return result ["error" ]
@@ -168,7 +174,7 @@ def download_result(remote_json_field: Optional[str], format: str):
168174 "Expected the result format to be either `ndjson` or `json`."
169175 )
170176
171- if self .name == 'JSON Import' or self . type == 'adv-upsert-data-rows' :
177+ if self .is_creation_task () :
172178 format = 'json'
173179 elif self .type == 'export-data-rows' :
174180 format = 'ndjson'
0 commit comments