From df8ef2e4298fb17b1338a2666dc84c4c44650de9 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 28 Sep 2022 10:49:16 -0400 Subject: [PATCH] add the exception to the result for script unit tests --- .../services/script_unit_test_runner.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/spiffworkflow_backend/services/script_unit_test_runner.py b/src/spiffworkflow_backend/services/script_unit_test_runner.py index 0aea5cf7..cb5aa4a6 100644 --- a/src/spiffworkflow_backend/services/script_unit_test_runner.py +++ b/src/spiffworkflow_backend/services/script_unit_test_runner.py @@ -37,7 +37,14 @@ class ScriptUnitTestRunner: ) -> ScriptUnitTestResult: """Run_task.""" task.data = input_context - cls._script_engine.execute(task, script) + + try: + cls._script_engine.execute(task, script) + except Exception as ex: + return ScriptUnitTestResult( + result=False, + error=f"Failed to execute script: {str(ex)}", + ) result_as_boolean = task.data == expected_output_context script_unit_test_result = ScriptUnitTestResult(