pub enum Error {
NoAvailableServer,
NotFound,
Rpc(ErrorObject),
Http {
status: u16,
method: String,
body: String,
},
Transport(Error),
Json(Error),
Other(String),
}Expand description
Errors returned by RPC operations.
Variants§
NoAvailableServer
NotFound
The method was not found locally and no host is configured (the RPC was created with an empty host and only handles overrides).
Rpc(ErrorObject)
A JSON-RPC error object returned by the server. This is a valid
response — it is not retried against other servers by
RpcList.
Http
A non-2xx HTTP status was returned with a body that was not a JSON-RPC
error. body is a trimmed snippet (at most 200 bytes).
Fields
Transport(Error)
A transport-level failure from the underlying HTTP client.
Json(Error)
A JSON encoding or decoding failure.
Other(String)
Any other error (e.g. an override function failure, or an unsupported argument shape).
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_rpc_error(&self) -> bool
pub fn is_rpc_error(&self) -> bool
Reports whether this error is a JSON-RPC error object (a valid response
from the server). Mirrors Go’s errors.As(err, &*ErrorObject).
Sourcepub fn as_rpc_error(&self) -> Option<&ErrorObject>
pub fn as_rpc_error(&self) -> Option<&ErrorObject>
Returns the underlying ErrorObject if this is a JSON-RPC error.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()