Skip to content

Commit 69c5870

Browse files
committed
Relay error messages
1 parent f425bfd commit 69c5870

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

python-lib/rest_api_recipe_session.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,18 @@ def retrieve_next_page(self, is_raw_output):
7070
page_rows = []
7171
logger.info("retrieve_next_page: Calling next page")
7272
json_response = self.client.paginated_api_call(can_raise_exeption=False)
73-
metadata = self.client.get_metadata() if self.display_metadata else {DKUConstants.REPONSE_ERROR_KEY: None}
73+
metadata = self.client.get_metadata() if self.display_metadata else {
74+
DKUConstants.REPONSE_ERROR_KEY: json_response.get(DKUConstants.REPONSE_ERROR_KEY, None)
75+
}
7476
is_api_returning_dict = True
7577
if self.extraction_key:
7678
data_rows = get_value_from_path(json_response, self.extraction_key.split("."), can_raise=False)
7779
if data_rows is None:
7880
error_message = "Extraction key '{}' was not found in the incoming data".format(self.extraction_key)
7981
if self.can_raise:
8082
raise DataikuException(error_message)
83+
elif DKUConstants.REPONSE_ERROR_KEY in metadata:
84+
return [metadata]
8185
else:
8286
return self.format_page_rows([{DKUConstants.REPONSE_ERROR_KEY: error_message}], is_raw_output, metadata)
8387
page_rows.extend(self.format_page_rows(data_rows, is_raw_output, metadata))

0 commit comments

Comments
 (0)