Added try/except support to run_key.
Change-Id: Id4da1c8bc0205fa2a8a2a7ca9ff11636b1d4ad45
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/gen_robot_keyword.py b/lib/gen_robot_keyword.py
index 6d2d0f5..f7d89ce 100755
--- a/lib/gen_robot_keyword.py
+++ b/lib/gen_robot_keyword.py
@@ -68,8 +68,12 @@
if test_mode:
return 'PASS', ""
- status, ret_values = \
- BuiltIn().run_keyword_and_ignore_error(*keyword_list)
+ try:
+ status, ret_values = \
+ BuiltIn().run_keyword_and_ignore_error(*keyword_list)
+ except Exception as my_assertion_error:
+ status = "FAIL"
+ ret_values = my_assertion_error.args[0]
if not (status == 'PASS' or ignore):
# Output the error message to stderr.