From 98b76370b1b64eafc354c6a0283f2c9977b5c91c Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 26 Oct 2022 16:24:47 -0400 Subject: [PATCH] Squashed 'SpiffWorkflow/' changes from bb9832928..12f81480a 12f81480a Merge pull request #258 from sartography/bugfix/script-attribute-error 7ca0917eb pass script to workflow task exec exception git-subtree-dir: SpiffWorkflow git-subtree-split: 12f81480a5f9e848e64221b9287c6cfa6cb682b4 --- SpiffWorkflow/bpmn/PythonScriptEngine.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/SpiffWorkflow/bpmn/PythonScriptEngine.py b/SpiffWorkflow/bpmn/PythonScriptEngine.py index ee4b3765..17772992 100644 --- a/SpiffWorkflow/bpmn/PythonScriptEngine.py +++ b/SpiffWorkflow/bpmn/PythonScriptEngine.py @@ -144,7 +144,7 @@ class PythonScriptEngine(object): self.check_for_overwrite(task, external_methods or {}) self._execute(script, task.data, external_methods or {}) except Exception as err: - wte = self.create_task_exec_exception(task, err) + wte = self.create_task_exec_exception(task, script, err) self.error_tasks[task.id] = wte raise wte @@ -153,7 +153,7 @@ class PythonScriptEngine(object): tasks.""" raise NotImplementedError("To call external services override the script engine and implement `call_service`.") - def create_task_exec_exception(self, task, err): + def create_task_exec_exception(self, task, script, err): if isinstance(err, WorkflowTaskExecException): return err @@ -170,8 +170,7 @@ class PythonScriptEngine(object): for frame_summary in traceback.extract_tb(tb): if frame_summary.filename == '': line_number = frame_summary.lineno - error_line = task.task_spec.script.splitlines()[ - line_number - 1] + error_line = script.splitlines()[line_number - 1] return WorkflowTaskExecException(task, detail, err, line_number, error_line)