exception documentation

A Nexus handler error.

This exception is used to represent errors that occur during the handling of a Nexus operation that should be reported to the caller as a handler error.

Example

import nexusrpc

# Raise a bad request error
raise nexusrpc.HandlerError(
    "Invalid input provided",
    type=nexusrpc.HandlerErrorType.BAD_REQUEST
)

# Raise a retryable internal error
raise nexusrpc.HandlerError(
    "Database unavailable",
    type=nexusrpc.HandlerErrorType.INTERNAL,
    retryable_override=True
)
Method __init__ Initialize a new HandlerError.
Instance Variable message Undocumented
Instance Variable original_failure Undocumented
Instance Variable raw_error_type Undocumented
Instance Variable retryable_override Undocumented
Instance Variable stack_trace Undocumented
Instance Variable type Undocumented
Property retryable Whether this error should be retried.
def __init__(self, message: str, *, type: HandlerErrorType | str, retryable_override: bool | None = None, stack_trace: str | None = None, original_failure: Failure | None = None):

Initialize a new HandlerError.

Parameters
message:strA descriptive message for the error.
type:HandlerErrorType | strThe HandlerErrorType of the error, or a string representation of the error type. If a string is provided and doesn't match a known error type, it will be treated as UNKNOWN and a warning will be logged.
retryable_override:bool | NoneOptionally set whether the error should be retried. By default, the error type is used to determine this.
stack_trace:str | NoneAn optional stack trace string.
original_failure:Failure | NoneSet if this error is constructed from a failure object.
message =

Undocumented

original_failure =

Undocumented

raw_error_type =

Undocumented

retryable_override =

Undocumented

stack_trace =

Undocumented

type =

Undocumented

@property
retryable: bool =

Whether this error should be retried.

If retryable_override is None, then the default behavior for the error type is used. See https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors