Skip to content

Commit

Permalink
Merge pull request #310 from sartography/feature/add_task_not_found_e…
Browse files Browse the repository at this point in the history
…rror

added an exception for task not found w/ burnettk
  • Loading branch information
essweine committed Apr 5, 2023
2 parents e1add83 + b98efbd commit 37d7ae6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions SpiffWorkflow/exceptions.py
Expand Up @@ -129,3 +129,7 @@ def __init__(self, error_msg, task=None, exception=None,

class StorageException(SpiffWorkflowException):
pass


class TaskNotFoundException(WorkflowException):
pass
5 changes: 3 additions & 2 deletions SpiffWorkflow/workflow.py
Expand Up @@ -23,10 +23,11 @@
from .task import Task, TaskState
from .util.compat import mutex
from .util.event import Event
from .exceptions import WorkflowException
from .exceptions import TaskNotFoundException, WorkflowException

logger = logging.getLogger('spiff')


class Workflow(object):

"""
Expand Down Expand Up @@ -246,7 +247,7 @@ def get_task_from_id(self, task_id, tasklist=None):
if task.id == task_id:
return task
msg = 'A task with the given task_id (%s) was not found' % task_id
raise WorkflowException(msg, task_spec=self.spec)
raise TaskNotFoundException(msg, task_spec=self.spec)

def run_task_from_id(self, task_id):
"""
Expand Down

0 comments on commit 37d7ae6

Please sign in to comment.