Skip to main content
function NotBuilt.type
def NotBuilt.type(
*,
fields: dict[str, field | type] = …,
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 field(type, default = ...) for an optional field, as record() 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 NotBuilt.cause
NotBuilt.cause: None | error
The error that led to this one, or None. property NotBuilt.message
NotBuilt.message: str
What went wrong, as given to the constructor. str(e) returns it too. property NotBuilt.stacktrace
NotBuilt.stacktrace: list[error_frame]
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. property NotBuilt.target
NotBuilt.target: str
The target, as it was asked for.