xtr_workflow.exception ¶
Every error this package defines, each deriving from :class:WorkflowError.
InvalidArgumentError ¶
Bases: WorkflowError, ValueError
A value handed to a workflow, or to one of its parts, cannot be used.
An arc's weight below 1, a number of tokens a place cannot give: each is refused where it is handed over, before it changes anything.
InvalidDefinitionError ¶
Bases: LogicError
A definition breaks a rule of the workflow type meant to run it.
Raised by a definition validator: a state machine's transition leaving from two places, two transitions of one name leaving the same place. A validator checks a definition before a workflow runs it, so the mistake shows where the definition is made rather than halfway through a move.
LogicError ¶
Bases: WorkflowError
A workflow was used in a way that cannot work.
A transition applied where none of that name exists or none is enabled, a definition its type cannot run: each is a mistake in how the workflow is defined or called, not a failure of something it depends on.
NotEnabledTransitionError ¶
NotEnabledTransitionError(subject: object, transition_name: str, workflow: WorkflowInterface, transition_blocker_list: TransitionBlockerList, context: Mapping[str, object] | None = None)
Bases: TransitionError
A transition is defined, but its blockers keep it from being applied to the subject.
The marking may lack the tokens the transition takes, or a guard may have refused it; the blocker list it carries says which, and why.
Record the blocked call and what blocks it.
Parameters:
-
subject(object) –The object the transition was to move.
-
transition_name(str) –The name of the transition.
-
workflow(WorkflowInterface) –The workflow the transition was applied through.
-
transition_blocker_list(TransitionBlockerList) –What blocks the transition.
-
context(Mapping[str, object] | None, default:None) –The context the call was given.
get_transition_blocker_list ¶
Return what blocks the transition.
TransitionError ¶
TransitionError(subject: object, transition_name: str, workflow: WorkflowInterface, message: str, context: Mapping[str, object] | None = None)
Bases: LogicError
A transition could not be applied to a subject.
It keeps what the call was given — the subject, the transition's name, the workflow and the context — so whoever catches it can say which object was refused which move, by which workflow, without having kept them aside.
Record the call that failed and why.
Parameters:
-
subject(object) –The object the transition was to move.
-
transition_name(str) –The name of the transition.
-
workflow(WorkflowInterface) –The workflow the transition was applied through.
-
message(str) –Why the transition could not be applied.
-
context(Mapping[str, object] | None, default:None) –The context the call was given.
UndefinedTransitionError ¶
UndefinedTransitionError(subject: object, transition_name: str, workflow: WorkflowInterface, context: Mapping[str, object] | None = None)
Bases: TransitionError
A transition was applied that the workflow's definition does not have.
Record the call naming a transition the definition does not have.
Parameters:
-
subject(object) –The object the transition was to move.
-
transition_name(str) –The name no transition of the definition has.
-
workflow(WorkflowInterface) –The workflow the transition was applied through.
-
context(Mapping[str, object] | None, default:None) –The context the call was given.
WorkflowRuntimeError ¶
Bases: WorkflowError, RuntimeError
Something a workflow depends on failed while it ran, rather than how it was used.