Handling empty task state

This commit is contained in:
Carlos Lopez 2020-06-16 13:13:30 -06:00
parent 7e1bc6062c
commit 59d66be10f
1 changed files with 2 additions and 0 deletions

View File

@ -188,6 +188,8 @@ def update_task(workflow_id, task_id, body):
processor = WorkflowProcessor(workflow_model) processor = WorkflowProcessor(workflow_model)
task_id = uuid.UUID(task_id) task_id = uuid.UUID(task_id)
task = processor.bpmn_workflow.get_task(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: if task.state != task.READY:
raise ApiError("invalid_state", "You may not update a task unless it is in the READY state. " 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.") "Consider calling a token reset to make this task Ready.")