bitcoinsv_rpc/
error.rs

1//! Error types for the Fandango library.
2
3use thiserror::Error;
4
5/// A specialized Result type for Fandango operations.
6pub type Result<T> = std::result::Result<T, Error>;
7
8/// The error type for Fandango operations.
9#[derive(Error, Debug)]
10pub enum Error {
11    /// HTTP request failed
12    #[error("HTTP request failed: {0}")]
13    Http(#[from] reqwest::Error),
14
15    /// JSON-RPC error response from node
16    #[error("RPC error: code {code}, message: {message}")]
17    Rpc { code: i32, message: String },
18
19    /// Failed to parse JSON response
20    #[error("JSON parsing failed: {0}")]
21    Json(#[from] serde_json::Error),
22
23    /// Failed to decode hex string
24    #[error("Hex decoding failed: {0}")]
25    Hex(#[from] hex::FromHexError),
26
27    /// Failed to parse Bitcoin SV data
28    #[error("Bitcoin SV parsing failed: {0}")]
29    BitcoinSv(String),
30
31    /// Invalid URL provided
32    #[error("Invalid URL: {0}")]
33    InvalidUrl(String),
34
35    /// Authentication required but not provided
36    #[error("Authentication required but credentials not provided")]
37    AuthRequired,
38
39    /// Invalid configuration
40    #[error("Invalid configuration: {0}")]
41    Config(String),
42
43    /// Other errors
44    #[error("Error: {0}")]
45    Other(String),
46}