From 6742dacf8a527c63d53f3d0b3ba6a4d71e83a60e Mon Sep 17 00:00:00 2001 From: David Esner Date: Mon, 27 May 2024 12:01:06 +0200 Subject: [PATCH] Validate respojnse path --- python-sync-actions/src/component.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/python-sync-actions/src/component.py b/python-sync-actions/src/component.py index 985d667..6b17164 100644 --- a/python-sync-actions/src/component.py +++ b/python-sync-actions/src/component.py @@ -239,13 +239,13 @@ def _parse_data(self, data, path) -> list: value = value[key] result = value except KeyError: - raise UserException(f"Path {path.path} not found in the response data") + return [f"Path {path.path} not found in the response data"] # TODO: check if the result is list - # if not isinstance(result, list): - # element_name = 'root' if path.path == '.' else path.path - # raise UserException(f"The {element_name} element of the response is not list, " - # "please change your Record Selector path to list") + if not isinstance(result, list): + element_name = 'root' if path.path == '.' else path.path + return [f"The {element_name} element of the response is not a list, " + f"please change your Record Selector path to list"] return result