display the evaluation error when evaluating an expression instead of the NoneType error w/ burnettk

This commit is contained in:
jasquat 2022-09-13 10:39:08 -04:00
parent 5524062702
commit 59c10c1778
2 changed files with 14 additions and 5 deletions

View File

@ -330,6 +330,8 @@ def process_instance_run(
if do_engine_steps:
try:
processor.do_engine_steps()
except ApiError as e:
raise e
except Exception as e:
ErrorHandlingService().handle_error(processor, e)
task = processor.bpmn_process_instance.last_task

View File

@ -97,11 +97,18 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
try:
return super()._evaluate(expression, context)
except Exception as exception:
raise WorkflowTaskExecException(
task,
"Error evaluating expression "
"'%s', %s" % (expression, str(exception)),
) from exception
if task is None:
raise ApiError(
"error_evaluating_expression",
"Error evaluating expression: "
"'%s', exception: %s" % (expression, str(exception)),
) from exception
else:
raise WorkflowTaskExecException(
task,
"Error evaluating expression "
"'%s', %s" % (expression, str(exception)),
) from exception
def execute(self, task: SpiffTask, script: str) -> None:
"""Execute."""