From 3bce11b3bd175680bb6ebca157847318afee5959 Mon Sep 17 00:00:00 2001 From: atthaboons Date: Fri, 27 Mar 2020 15:56:51 +0700 Subject: [PATCH] Add proper error when can't select data based on given condition --- ExcelDataDriver/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ExcelDataDriver/__init__.py b/ExcelDataDriver/__init__.py index 865391c..ac080fd 100644 --- a/ExcelDataDriver/__init__.py +++ b/ExcelDataDriver/__init__.py @@ -39,7 +39,7 @@ from ExcelDataDriver.Config.CaptureScreenShotOption import CaptureScreenShotOption -__version__ = '1.1.5' +__version__ = '1.1.6' class ExcelDataDriver: @@ -579,7 +579,10 @@ def select_reference_data_based_on_condition(self, alias_name, condition): sheet_name string properties_list dictionary: access to excel property with lower case and use _ instead of space """ - self.reference_data[alias_name]['selected'] = next(data for data in self.reference_data[alias_name]['data'] if eval(condition)) + try: + self.reference_data[alias_name]['selected'] = next(data for data in self.reference_data[alias_name]['data'] if eval(condition)) + except Exception: + raise Exception("Can't select reference data based on condition "+str(condition)) @keyword def get_selected_reference_data_property(self, alias_name, property_name):