GitHub

ErrorInstance

API reference for ErrorInstance.

An error read from its JSON form, as Effect's Error with the name the input gave (the class stays this one, whatever the name): its message, name, stack and cause (Some of the decoded cause, Some(None) for a null one). Equal when those are.

The class is also the schema of errors (Effect's ErrorInstance()): it takes an exception (Expected Error otherwise), written in JSON as above. ErrorInstance.schema takes the options.

Attributes

AttributeTypeDescription
messagestr = message
namestr = name
stackstr | None = stack
causeOption[object] = cause

Functions

__init__

__init__(message, *, name='Error', stack=None, cause=None) -> None
ParameterTypeDescription
messagestr
namestr = 'Error'
stackstr | None = None
causeOption[object] = None
def __init__(
    self,
    message: str,
    *,
    name: str = "Error",
    stack: str | None = None,
    cause: Option[object] = None,
) -> None:
    super().__init__(message)
    self.message = message
    self.name = name
    self.stack = stack
    self.cause = cause

schema

schema(*, include_stack=False, exclude_cause=False) -> Bottom[BaseException]

The schema of errors; include_stack writes the stack, exclude_cause leaves the cause out. The same options give the same schema.

ParameterTypeDescription
include_stackbool = False
exclude_causebool = False

Returns Bottom[BaseException]

@staticmethod
def schema(
    *, include_stack: bool = False, exclude_cause: bool = False
) -> Bottom[BaseException]:
    """The schema of errors; ``include_stack`` writes the stack,
    ``exclude_cause`` leaves the cause out. The same options give the
    same schema."""
    return error_schema(include_stack, exclude_cause)