xtr_clock.exception ¶
Every error this library raises.
All of them derive from :class:ClockError, so one except catches
anything a clock can go wrong with, and a narrower one handles a single
cause. Each carries the data a caller needs as typed attributes rather than
forcing a message to be parsed.
ClockError ¶
Bases: Exception
Base class for every error raised by this library.
Catch this to handle anything reading a clock can go wrong with; catch a subclass to handle one cause. Every subclass carries the data a caller needs as typed attributes and composes its own message from them.
InvalidModifierError ¶
Bases: ClockError, ValueError
A modifier string the grammar cannot read.
Raised where the modifier is written rather than silently resolving to
the current instant, so a typo in '+1 dya' is a failure and not a
date that looks plausible.
Also a :class:ValueError, so code that already guards parsing with
except ValueError keeps working without learning a new exception.
Attributes:
Record the modifier that could not be read, and why.
InvalidTimezoneError ¶
Bases: ClockError, ValueError
A timezone was named that this system cannot resolve.
Also a :class:ValueError, so code that already guards a conversion with
except ValueError keeps working without learning a new exception.
Attributes:
-
timezone(str) –The name that could not be resolved.
Record the name that could not be resolved.