exception documentation
class HandlerError(Exception):
Constructor: HandlerError(message, type, retryable_override)
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=True )
Method | __init__ |
Initialize a new HandlerError. |
Property | retryable |
Whether this error should be retried. |
Property | retryable |
The optional retryability override set when this error was created. |
Property | type |
The type of handler error. |
Instance Variable | _retryable |
Undocumented |
Instance Variable | _type |
Undocumented |
def __init__(self, message:
str
, *, type: HandlerErrorType
, retryable_override: bool | None
= None):
¶
Initialize a new HandlerError.
Parameters | |
message:str | A descriptive message for the error. This will become
the message in the resulting Nexus Failure object. |
type:HandlerErrorType | The HandlerErrorType of the error. |
retryablebool | None | Optionally set whether the error should be retried. By default, the error type is used to determine this. |
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
The type of handler error.
See HandlerErrorType
and
https://github.com/nexus-rpc/api/blob/main/SPEC.md#predefined-handler-errors.