exception documentation

class OperationError(Exception):

Constructor: OperationError(message, state)

View In Hierarchy

An error that represents "failed" and "canceled" operation results.

Example

import nexusrpc

# Indicate operation failed
raise nexusrpc.OperationError(
    "Processing failed due to invalid data",
    state=nexusrpc.OperationErrorState.FAILED
)

# Indicate operation was canceled
raise nexusrpc.OperationError(
    "Operation was canceled by user request",
    state=nexusrpc.OperationErrorState.CANCELED
)
Parameters
messageA descriptive message for the error. This will become the message in the resulting Nexus Failure object.
state
Method __init__ Undocumented
Property state The state of the operation.
Instance Variable _state Undocumented
def __init__(self, message: str, *, state: OperationErrorState):

Undocumented

@property
state: OperationErrorState =

The state of the operation.

_state =

Undocumented