Skip to content

epymorph.error

A common exception framework for epymorph.

ExternalDependencyError

ExternalDependencyError(msg: str, missing: list[str])

Bases: Exception

Exception when a native program is required but not found.

missing instance-attribute

missing: list[str] = missing

Which programs are missing?

GeographyError

Bases: Exception

Exception working with geographic system representations.

DimensionError

Bases: Exception

Raised when epymorph needed dimensional information that was not provided.

ValidationError

Bases: Exception

Superclass for exceptions which happen during simulation validation.

DataAttributeError

Bases: ValidationError

Exception handling data attributes.

DataAttributeErrorGroup

Bases: ExceptionGroup, DataAttributeError

Multiple exceptions encountered handling data attributes.

MissingContextError

Bases: Exception

Exception during simulation function evaluation, where the function required context elements that were not provided.

DataResourceError

Bases: Exception

Exception during resource loading from ADRIOs.

IPMValidationError

Bases: ValidationError

Exception for invalid IPM.

MMValidationError

Bases: ValidationError

Exception for invalid MM.

InitValidationError

Bases: ValidationError

Exception for invalid Init.

SimValidationError

Bases: ValidationError

Exception for cases where a simulation is invalid as configured, typically because the MM, IPM, or Initializer require data attributes that are not available.

SimCompilationError

Bases: Exception

Exception during the compilation phase of the simulation.

SimulationError

Bases: Exception

Superclass for exceptions which happen during simulation runtime.

InitError

Bases: SimulationError

Exception for invalid initialization.

IPMSimError

Bases: SimulationError

Exception during IPM processing.

IPMSimWithFieldsError

IPMSimWithFieldsError(
    message: str, display_fields: list[tuple[str, dict]]
)

Bases: IPMSimError

Exception during IPM processing where it is appropriate to show specific fields within the simulation. To create a new error with fields, create a subclass of this and set the displayed error message along with the fields to print. See 'IpmSimNaNException' for an example.

display_fields instance-attribute

display_fields: list[tuple[str, dict]] = display_fields

IPMSimNaNError

IPMSimNaNError(display_fields: list[tuple[str, dict]])

Bases: IPMSimWithFieldsError

Exception for handling NaN (not a number) rate values

IPMSimLessThanZeroError

IPMSimLessThanZeroError(
    display_fields: list[tuple[str, dict]],
)

Bases: IPMSimWithFieldsError

Exception for handling less than 0 rate values

IPMSimInvalidProbsError

IPMSimInvalidProbsError(
    display_fields: list[tuple[str, dict]],
)

Bases: IPMSimWithFieldsError

Exception for handling invalid probability values

MMSimError

Bases: SimulationError

Exception during MM processing.

error_gate

error_gate(
    description: str,
    exception_type: type[Exception],
    *reraises: type[Exception],
)

Provide nice error messaging linked to a phase of the simulation. description should describe the phase in gerund form. If an exception of type exception_type is caught, it will be re-raised as-is. If an exception is caught from the list of exception types in reraises, the exception will be stringified and re-raised as exception_type. All other exceptions will be labeled "unknown errors" with the given description.