pub trait ErrorResponseCode {
// Required method
fn error_response_code(&self) -> Option<i64>;
}Expand description
A transport error that may carry a JSON-RPC error in its raw response body.
RpcError is generic over its transport error, which is defined by downstream transport
crates and therefore opaque here. This trait is the hook those crates implement so that
RpcError::error_code can reach JSON-RPC errors that never made it through JSON-RPC decoding,
such as an error served with a non-2xx HTTP status.
Implementors own the parsing, since they own the wire format their body arrives in.
Required Methods§
Sourcefn error_response_code(&self) -> Option<i64>
fn error_response_code(&self) -> Option<i64>
Returns the JSON-RPC error code carried in this error’s raw response body, if the body contains a JSON-RPC error at all.
Returns None when the error carries no body, or when the body is not a JSON-RPC error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".