pub trait IntoErrorCode {
// Required methods
fn error_code(&self) -> ErrorCode;
fn message(&self) -> String;
// Provided method
fn jsonrpc_code(&self) -> i32 { ... }
}Expand description
Trait for converting errors to protocol-agnostic error codes.
Implement this for your error types, or use the derive macro.
Required Methods§
Sourcefn error_code(&self) -> ErrorCode
fn error_code(&self) -> ErrorCode
Get the error code for this error
Provided Methods§
Sourcefn jsonrpc_code(&self) -> i32
fn jsonrpc_code(&self) -> i32
Get the JSON-RPC numeric error code for this error.
Defaults to the code derived from error_code(). Override this for
per-variant JSON-RPC codes (e.g. -32602 for invalid params).