nexusrpc.OperationError

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

Example

import nexusrpc


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


raise nexusrpc.OperationError(
    "Operation was canceled by user request",
    state=nexusrpc.OperationErrorState.CANCELED
)
Method __init__ Initialize a new OperationError.
Instance Variable message Undocumented
Instance Variable original_failure Undocumented
Instance Variable stack_trace Undocumented
Instance Variable state Undocumented

Initialize a new OperationError.

Parameters
message:strA descriptive message for the error.
state:OperationErrorStateThe state of the operation (OperationErrorState).
stack_trace:str | NoneAn optional stack trace string.
original_failure:Failure | NoneSet if this error is constructed from a failure object.