1#!/usr/bin/env python3
2"""
3These are the doot specific errors that can occur
4"""
5# Imports:
6from __future__ import annotations
7
8# ##-- stdlib imports
9import logging as logmod
10from typing import (TYPE_CHECKING, Any, Callable, ClassVar, Final, Generator,
11 Generic, Iterable, Iterator, Mapping, Match,
12 MutableMapping, Protocol, Sequence, Tuple, TypeAlias,
13 TypeGuard, TypeVar, cast, final, overload,
14 runtime_checkable)
15
16# ##-- end stdlib imports
17
18from ._base import DootError, BackendError
19
20if TYPE_CHECKING:
21 from jgdv import Maybe
22 from doot.workflow._interface import Task_i, TaskName_p, Artifact_i, TaskSpec_i
23
24##-- logging
25logging = logmod.getLogger(__name__)
26##-- end logging
27
28# ##-- Generated Exports
29__all__ = ( # noqa: RUF022
30
31# -- Classes
32"ActionError", "ActionStateError", "TaskError", "TaskFailed", "TaskTrackingError",
33
34)
35# ##-- end Generated Exports
36
[docs]
37class TaskError(BackendError):
38 """ An Error indicating a specific task failed """
39 task : Maybe
40
41 general_msg = "Doot Task Error:"
42
43 def __init__(self, msg:str, *args:Any, task:Maybe[Task_i|TaskSpec_i]=None):
44 super().__init__(msg, *args)
45 self.task = task
46
[docs]
47class TaskFailed(TaskError): # noqa: N818
48 """ A Task attempted to run, but failed in some way. """
49 general_msg = "Doot Task Failure:"
50 pass
51
[docs]
52class TaskTrackingError(TaskError):
53 """ The underlying sequencing of task running failed in some way. """
54 general_msg = "Doot Tracking Failure:"
55 pass
56
[docs]
57class ActionError(TaskError):
58 """ In the course of executing a task, one of it's actions failed. """
59 general_msg = "Doot Action Failure:"
60 pass
61
[docs]
62class ActionStateError(ActionError):
63 """ An action required certain state to exist, but it wasn't found. """
64 general_msg = "Doot Action State Fields Missing:"
65 pass