Skip to content

err ¤

The error handling logic.

Contains error and exception definitions.

Classes:

  • ErrorCode

    Describes which error occured.

  • Status

    An error handling object.

  • TypeNotRecovered

    We tried to recover (i.e. look up in the debugger and craft ourselves) the

  • TypeNotFound

    The type is not in the debugger.

ErrorCode ¤

Bases: Enum

Describes which error occured.

Feel free to add a new one.

Attributes:

SUCCESS class-attribute instance-attribute ¤

SUCCESS = 0

FAILURE class-attribute instance-attribute ¤

FAILURE = 1

Generic failure

NO_STRUCTURE_FILE class-attribute instance-attribute ¤

NO_STRUCTURE_FILE = 2

We tried to load a structure, but the associated structure file doesn't exist.

Status dataclass ¤

Status(code: ErrorCode = SUCCESS, message: str = '')

An error handling object.

Passing no arguments (i.e. doing Status()) represents a success.

Methods:

  • is_success

    Returns True if the Status object denotes a success.

  • is_failure

    Returns True if the Status object denotes a failure.

  • succeed

    Create a Status object that represents a success.

  • fail

    Create a Status object that represents a generic failure.

  • coded_fail

    Create a Status object that represents a failure.

Attributes:

  • code (ErrorCode) –

    An error code associated with this error.

  • message (str) –

    If is_failure() returns True, this attribute contains the error message.

code instance-attribute ¤

code: ErrorCode = code

An error code associated with this error.

message class-attribute instance-attribute ¤

message: str = message

If is_failure() returns True, this attribute contains the error message.

is_success ¤

is_success() -> bool

Returns True if the Status object denotes a success.

is_failure ¤

is_failure() -> bool

Returns True if the Status object denotes a failure.

succeed staticmethod ¤

succeed() -> Status

Create a Status object that represents a success.

fail staticmethod ¤

fail(message: str = '') -> Status

Create a Status object that represents a generic failure.

coded_fail staticmethod ¤

coded_fail(code: ErrorCode, message: str = '') -> Status

Create a Status object that represents a failure.

TypeNotRecovered ¤

TypeNotRecovered(name: str, msg: str)

Bases: Exception

We tried to recover (i.e. look up in the debugger and craft ourselves) the type name but failed because of msg.

Attributes:

name instance-attribute ¤

name = name

TypeNotFound ¤

Bases: Exception

The type is not in the debugger.