X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/8a7500e86bc3acd030d91c29eb694fac53d0c906..b1f2be4453e6c58f751cfcd58459c28fc7fe6efc:/tasklib/task.py diff --git a/tasklib/task.py b/tasklib/task.py index 1121988..9af111b 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -421,6 +421,12 @@ class Task(TaskResource): """ pass + class ActiveTask(Exception): + """ + Raised when the operation cannot be performed on the active task. + """ + pass + class InactiveTask(Exception): """ Raised when the operation cannot be performed on an inactive task. @@ -600,6 +606,8 @@ class Task(TaskResource): raise Task.CompletedTask("Cannot start a completed task") elif self.deleted: raise Task.DeletedTask("Deleted task cannot be started") + elif self.active: + raise Task.ActiveTask("Task is already active") self.warrior.execute_command([self['uuid'], 'start'])