Skip to main content

smplx_sdk/provider/rpc/
error.rs

1/// Errors that can occur when calling JSON-RPC methods on a Bitcoin Core or Elements node.
2#[derive(thiserror::Error, Debug)]
3pub enum RpcError {
4    /// Transparent wrapper mapping underlying errors generated directly from the Core/Elements RPC node client.
5    #[error(transparent)]
6    ElementsRpcError(#[from] electrsd::bitcoind::bitcoincore_rpc::Error),
7
8    /// Error indicating the requested Elements RPC call succeeded but the resulting JSON data payload did not map to the expected type or structure.
9    #[error("Elements RPC returned an unexpected value for call {0}")]
10    ElementsRpcUnexpectedReturn(String),
11
12    /// Error thrown when an invalid hex string fails to parse back into an exact byte array sequence.
13    #[error("Failed to decode hex value to array, {0}")]
14    BitcoinHashesHex(#[from] bitcoin_hashes::hex::HexToArrayError),
15}