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: if do_engine_steps:
try: try:
processor.do_engine_steps() processor.do_engine_steps()
except ApiError as e:
raise e
except Exception as e: except Exception as e:
ErrorHandlingService().handle_error(processor, e) ErrorHandlingService().handle_error(processor, e)
task = processor.bpmn_process_instance.last_task task = processor.bpmn_process_instance.last_task

View File

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