Skip to content

Exceptions

Every error raised by the package derives from IntegrixError and from the closest standard-library exception.

graph TD
    E[Exception] --> F[IntegrixError]
    V[ValueError] --> VE[ValidationError]
    F --> VE
    R[RuntimeError] --> CE[ConvergenceError]
    F --> CE

exceptions

Exception hierarchy for integrix.

Every error raised by this package derives from IntegrixError, so a caller can trap the whole package with a single except clause. Each concrete error also inherits from the closest standard-library exception, so code written against the stdlib keeps working without importing anything from this package.

IntegrixError

Bases: Exception

Base class for every exception raised by integrix.

Examples:

>>> from integrix import IntegrixError, ValidationError
>>> issubclass(ValidationError, IntegrixError)
True

ValidationError

Bases: IntegrixError, ValueError

Raised when an argument fails validation.

Also a ValueError, so except ValueError still catches it.

Examples:

>>> from integrix import ValidationError
>>> issubclass(ValidationError, ValueError)
True

ConvergenceError

Bases: IntegrixError, RuntimeError

Raised when an iterative solve fails to converge.

Also a RuntimeError, so except RuntimeError still catches it.

Examples:

>>> from integrix import ConvergenceError
>>> issubclass(ConvergenceError, RuntimeError)
True