Skip to content

exceptions

ProcessError

Bases: Exception

A base Exception to derive other PROCESS exceptions from

Source code in process/core/exceptions.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
class ProcessError(Exception):
    """A base Exception to derive other PROCESS exceptions from"""

    def __init__(self, *args, **kwargs):
        super().__init__(*args)
        self._diagnostics = kwargs

    def __str__(self):
        exception_message = super().__str__()
        diagnostics_message = "\n".join([
            f"\t{d}: {v!r}" for d, v in self._diagnostics.items()
        ])

        if diagnostics_message:
            return f"{exception_message}\n{diagnostics_message}"

        return exception_message

ProcessValidationError

Bases: ProcessError

Exception raised when validating PROCESS input. E.g. initial values, constraint/variable combinations, switch combinations

Source code in process/core/exceptions.py
20
21
22
class ProcessValidationError(ProcessError):
    """Exception raised when validating PROCESS input.
    E.g. initial values, constraint/variable combinations, switch combinations"""

ProcessValueError

Bases: ProcessError, ValueError

A ValueError in a PROCESS model.

Source code in process/core/exceptions.py
25
26
class ProcessValueError(ProcessError, ValueError):
    """A ValueError in a PROCESS model."""