pub enum ClientError {
Show 18 variants
MissingUserPassword,
Server(i32, String),
Parse(String),
Param(String),
Body(String),
Status(u16, String),
MalformedResponse(String),
Connection(String),
Timeout,
HttpRedirect(String),
ReqBuilder(String),
MaxRetriesExceeded(u8),
Request(String),
WrongNetworkAddress(Network),
UnexpectedServerVersion(UnexpectedServerVersionError),
Sign(SignRawTransactionWithWalletError),
Xpriv,
Other(String),
}Expand description
The error type for errors produced in this library.
Variants§
MissingUserPassword
Missing username or password for the RPC server
Server(i32, String)
RPC server returned an error
§Note
These errors are ABSOLUTELY UNDOCUMENTED. Check https://github.com/bitcoin/bitcoin/blob/96b0a8f858ab24f3672360b8c830553b963de726/src/rpc/protocol.h#L24 and good luck!
Parse(String)
Error parsing the RPC response, unlikely to be recoverable by retrying
Param(String)
Error creating the RPC request, retry might help
Body(String)
Body error, unlikely to be recoverable by retrying
Status(u16, String)
HTTP status error.
Server-side failures may be retriable, while client-side failures usually indicate configuration or authorization problems.
MalformedResponse(String)
Error decoding the response, retry might not help
Connection(String)
Connection error, retry might help
Timeout
Timeout error, retry might help
HttpRedirect(String)
Redirect error, not retryable
ReqBuilder(String)
Error building the request, unlikely to be recoverable
MaxRetriesExceeded(u8)
Maximum retries exceeded, not retryable
Request(String)
General request error, retry might help
WrongNetworkAddress(Network)
Wrong network address
UnexpectedServerVersion(UnexpectedServerVersionError)
Server version is unexpected or incompatible
Sign(SignRawTransactionWithWalletError)
Could not sign raw transaction
Xpriv
Could not get a Xpriv from the wallet
Other(String)
Unknown error, unlikely to be recoverable
Implementations§
Source§impl ClientError
impl ClientError
Sourcepub fn is_tx_not_found(&self) -> bool
pub fn is_tx_not_found(&self) -> bool
Returns true when the RPC server reports an invalid address, key, or missing
transaction/block identifier (RPC_INVALID_ADDRESS_OR_KEY, code -5).
Sourcepub fn is_block_not_found(&self) -> bool
pub fn is_block_not_found(&self) -> bool
Returns true when the RPC server reports an invalid address, key, or missing
transaction/block identifier (RPC_INVALID_ADDRESS_OR_KEY, code -5).
Sourcepub fn is_rpc_verify_error(&self) -> bool
pub fn is_rpc_verify_error(&self) -> bool
Returns true when the RPC server reports a general transaction or block
submission verification error (RPC_VERIFY_ERROR, code -25).
Sourcepub fn is_rpc_verify_rejected(&self) -> bool
pub fn is_rpc_verify_rejected(&self) -> bool
Returns true when the RPC server reports a transaction or block rejected
by network rules (RPC_VERIFY_REJECTED, code -26).
Sourcepub fn is_rpc_verify_already_in_utxo_set(&self) -> bool
pub fn is_rpc_verify_already_in_utxo_set(&self) -> bool
Returns true when the RPC server reports a transaction already present in
the UTXO set (RPC_VERIFY_ALREADY_IN_UTXO_SET, code -27).
Sourcepub fn is_retriable(&self) -> bool
pub fn is_retriable(&self) -> bool
Returns true when retrying the same RPC request may succeed later.
This classifies transport failures, timeouts, request-construction failures that can
depend on transient client state, exhausted client-side retries, and HTTP 5xx responses
as retriable. Bitcoin Core JSON-RPC server errors are operation-specific and return
false; callers should handle those according to the RPC they invoked.
Sourcepub fn is_missing_or_invalid_input(&self) -> bool
👎Deprecated since 0.10.4: use is_rpc_verify_error() to detect RPC_VERIFY_ERROR (-25)
pub fn is_missing_or_invalid_input(&self) -> bool
use is_rpc_verify_error() to detect RPC_VERIFY_ERROR (-25)
Returns true when the RPC server reports missing or invalid transaction
inputs (RPC_VERIFY_ERROR, code -25).
Trait Implementations§
Source§impl Clone for ClientError
impl Clone for ClientError
Source§fn clone(&self) -> ClientError
fn clone(&self) -> ClientError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientError
impl Debug for ClientError
Source§impl<'de> Deserialize<'de> for ClientError
impl<'de> Deserialize<'de> for ClientError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ClientError
impl Display for ClientError
Source§impl Error for ClientError
impl Error for ClientError
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()
Source§impl From<BitcoinRpcError> for ClientError
impl From<BitcoinRpcError> for ClientError
Source§fn from(value: BitcoinRpcError) -> Self
fn from(value: BitcoinRpcError) -> Self
Source§impl From<Error> for ClientError
impl From<Error> for ClientError
Source§fn from(value: BitreqError) -> Self
fn from(value: BitreqError) -> Self
Source§impl From<Error> for ClientError
impl From<Error> for ClientError
Source§fn from(value: SerdeJsonError) -> Self
fn from(value: SerdeJsonError) -> Self
Source§impl From<SignRawTransactionWithWalletError> for ClientError
impl From<SignRawTransactionWithWalletError> for ClientError
Source§fn from(source: SignRawTransactionWithWalletError) -> Self
fn from(source: SignRawTransactionWithWalletError) -> Self
Source§impl From<UnexpectedServerVersionError> for ClientError
impl From<UnexpectedServerVersionError> for ClientError
Source§fn from(source: UnexpectedServerVersionError) -> Self
fn from(source: UnexpectedServerVersionError) -> Self
Source§impl PartialEq for ClientError
impl PartialEq for ClientError
Source§fn eq(&self, other: &ClientError) -> bool
fn eq(&self, other: &ClientError) -> bool
self and other values to be equal, and is used by ==.