xtr_stopwatch.exception ¶
Everything this library raises, under :class:StopwatchError.
EventNotStartedError ¶
Bases: StopwatchError
An event was stopped, or lapped, while it was not running.
A stop with no start to pair it with has no period to close, so it is refused rather than recorded as nothing.
Attributes:
-
name(str) –The event that was not running.
Record the event that was not running.
NoStartedSectionError ¶
Bases: StopwatchError
A section was stopped while none was open.
The root section is always open and is never stopped, so stopping with only the root in place has nothing to stop.
Attributes:
-
section_id(str) –The id the section would have been stored under.
Record the id the stop was asked for.
StopwatchError ¶
Bases: Exception
Base class for every error raised by this library.
Catch this to handle anything timing can go wrong with; catch a subclass to handle one cause. Every subclass carries what went wrong as typed attributes and composes its own message from them.
UnknownEventError ¶
Bases: StopwatchError, LookupError
An event was asked for that the current section never started.
Also a :class:LookupError, as a missing key is.
Attributes:
-
name(str) –The event that is not known.
Record the event that is not known.
UnknownSectionError ¶
Bases: StopwatchError, LookupError
A section was reopened by an id the current section holds no child under.
Reopening adds periods to a section that was stopped earlier, and that is only meaningful at the level it lives at: a section started elsewhere is refused rather than silently begun afresh here.
Also a :class:LookupError, as a missing key is.
Attributes:
-
section_id(str) –The id that is not a child of the current section.
Record the id that was asked for.