Skip to main content
function error.type
def error.type(
*,
fields: dict[str, typing.Any] = ,
traceback: None | bool = None
) -> error_type
Derive a new error type from this one. The new type inherits every field of this type and adds fields. Its instances are also instances of this type and of each of its ancestors, for both isinstance and type annotations. The name comes from the variable the type is first assigned to, so declare error types at module top level. fields maps each field name to a type, or to attr(type, default = ...) for an optional field, as trait() does. message, stacktrace and cause are reserved, and an inherited field cannot be redeclared. traceback decides how an error of this type renders when it escapes the task. True shows the traceback, as for a bug. False prints the message alone as an ERROR: line and exits with code 1, as ctx.std.process.exit does: use it for expected refusals. Unset, it is inherited; the root error has True.
property error.cause
error.cause: typing.Any
The error that led to this one, or None. property error.message
error.message: str
What went wrong, as given to the constructor. str(e) returns it too. property error.stacktrace
error.stacktrace: typing.Any
Where the error was constructed, as a list of frames, outermost call first. For an error the runtime built from a failed operation, it is where that failure reached AXL, e.g. the future.block() call.