Source code for leaspy.exceptions
r"""
Define custom Leaspy exceptions for better downstream handling.
Exceptions classes are nested so to handle in the most convenient way for users::
Exception
|
|
LeaspyException RuntimeError
| \ |
| LeaspyConvergenceError
/ \
TypeError / \ ValueError
| / \ |
LeaspyTypeError LeaspyInputError
/ | | \
/ | | LeaspyIndividualParamsInputError
/ | |
LeaspyDataInputError | LeaspyAlgoInputError
|
LeaspyModelInputError
For I/O operations, non-Leaspy specific errors may be raised, in particular:
* :class:`FileNotFoundError`
* :class:`NotADirectoryError`
"""
[docs]
class LeaspyConvergenceError(LeaspyException, RuntimeError):
"""Leaspy Exception for errors relative to convergence."""
[docs]
class LeaspyTypeError(LeaspyException, TypeError):
"""Leaspy Exception, deriving from `TypeError`."""
[docs]
class LeaspyInputError(LeaspyException, ValueError):
"""Leaspy Exception, deriving from `ValueError`."""
[docs]
class LeaspyDataInputError(LeaspyInputError):
"""Leaspy Input Error for data related issues."""
[docs]
class LeaspyModelInputError(LeaspyInputError):
"""Leaspy Input Error for model related issues."""
[docs]
class LeaspyAlgoInputError(LeaspyInputError):
"""Leaspy Input Error for algorithm related issues."""
[docs]
class LeaspyIndividualParamsInputError(LeaspyInputError):
"""Leaspy Input Error for individual parameters related issues."""