From 59d66be10fcb9c21fe977b3c081c3e9719275d54 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Tue, 16 Jun 2020 13:13:30 -0600 Subject: [PATCH] Handling empty task state --- crc/api/workflow.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crc/api/workflow.py b/crc/api/workflow.py index 655a85e7..ae3fd86e 100644 --- a/crc/api/workflow.py +++ b/crc/api/workflow.py @@ -188,6 +188,8 @@ def update_task(workflow_id, task_id, body): processor = WorkflowProcessor(workflow_model) task_id = uuid.UUID(task_id) task = processor.bpmn_workflow.get_task(task_id) + if not task: + raise ApiError("empty_task", "Processor failed to obtain task.", status_code=404) if task.state != task.READY: raise ApiError("invalid_state", "You may not update a task unless it is in the READY state. " "Consider calling a token reset to make this task Ready.")