Skip to content

epymorph.error

Common epymorph exceptions.

ExternalDependencyError

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

Bases: Exception

Exception when epymorph requires a native program (or programs) to perform an application function but the program is not found.

Parameters:

  • msg (str) –

    The exception message.

  • missing (list[str]) –

    The list of external programs which are missing.

missing instance-attribute

missing: list[str] = missing

The list of external programs which 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 encountered handling a data attribute.

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.

IPMValidationError

Bases: ValidationError

Exception for invalid IPM.

MMValidationError

Bases: ValidationError

Exception for invalid MM.

InitValidationError

Bases: ValidationError

Exception for invalid Initializer.

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.

IPMSimNaNError

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

Bases: _WithFieldsMixin, IPMSimError

Exception raised when an IPM transition rate is NaN.

display_fields instance-attribute

display_fields = display_fields

IPMSimLessThanZeroError

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

Bases: _WithFieldsMixin, IPMSimError

Exception raised when an IPM transition rate is less than zero.

display_fields instance-attribute

display_fields = display_fields

IPMSimInvalidForkError

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

Bases: _WithFieldsMixin, IPMSimError

Exception raised when an IPM fork transition's probabilities are invalid.

display_fields instance-attribute

display_fields = display_fields

MMSimError

Bases: SimulationError

Exception during MM processing.

error_gate

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

Begin a context that standardizes errors linked to a particular simulation phase. Wrap the phase in an error gate and all exceptions raised within will be normalized.

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 as "unknown errors".

Parameters:

  • description (str) –

    Describe the phase in gerund form, e.g., "executing the IPM".

  • exception_type (type[Exception]) –

    The best exception type for this phase.

  • reraises (type[Exception], default: () ) –

    Additional exception types which will be stringified and raised as an exception_type.