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#
| Attribute | Type | Description |
|---|---|---|
message | str = message | |
name | str = name | |
stack | str | None = stack | |
cause | Option[object] = cause |
Functions#
__init__#
__init__(message, *, name='Error', stack=None, cause=None) -> None| Parameter | Type | Description |
|---|---|---|
message | str | |
name | str = 'Error' | |
stack | str | None = None | |
cause | Option[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 = causeschema#
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.
| Parameter | Type | Description |
|---|---|---|
include_stack | bool = False | |
exclude_cause | bool = 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)