Exceptions#

Every error raised by isoperiod derives from PeriodError, so catching that one handles them all.

PeriodError
├── PeriodParsingError      the string does not match any supported format
└── PeriodValidationError   parsed, but does not describe a usable period
exception isoperiod.PeriodError[source]#

Bases: Exception

Base exception for all period-related errors.

__init__(*args, **kwargs)#
classmethod __new__(*args, **kwargs)#
exception isoperiod.PeriodParsingError[source]#

Bases: PeriodError

Raised when things like a period string or timedelta cannot be parsed.

__init__(*args, **kwargs)#
classmethod __new__(*args, **kwargs)#
exception isoperiod.PeriodValidationError[source]#

Bases: PeriodError

Raised when a validation on objects in the Period module fails.

__init__(*args, **kwargs)#
classmethod __new__(*args, **kwargs)#

See Creating periods for how these come up in practice.