Source code for lena.core.exceptions
"""All Lena exceptions are subclasses of :exc:`LenaException`
and corresponding Python exceptions (if they exist).
"""
# pylint: disable=missing-docstring
# Most Exceptions here are familiar to Python programmers
# and are self-explanatory.
[docs]class LenaException(Exception):
"""Base class for all Lena exceptions."""
pass
[docs]class LenaAttributeError(LenaException, AttributeError):
pass
[docs]class LenaEnvironmentError(LenaException, EnvironmentError):
"""The base class for exceptions
that can occur outside the Python system,
like IOError or OSError.
"""
[docs]class LenaIndexError(LenaException, IndexError):
pass
[docs]class LenaKeyError(LenaException, KeyError):
pass
[docs]class LenaNotImplementedError(LenaException, NotImplementedError):
pass
[docs]class LenaRuntimeError(LenaException, RuntimeError):
"""Raised when an error does not belong to other categories."""
pass
[docs]class LenaStopFill(LenaException):
"""Signal that no more fill is accepted.
Analogous to StopIteration, but control flow is reversed.
"""
pass
[docs]class LenaTypeError(LenaException, TypeError):
pass
[docs]class LenaValueError(LenaException, ValueError):
pass
[docs]class LenaZeroDivisionError(LenaException, ZeroDivisionError):
# raised when, for example, mean can't be calculated
pass