1use thiserror::Error;
4
5pub type Result<T> = std::result::Result<T, Error>;
7
8#[derive(Error, Debug)]
10pub enum Error {
11 #[error("HTTP request failed: {0}")]
13 Http(#[from] reqwest::Error),
14
15 #[error("RPC error: code {code}, message: {message}")]
17 Rpc { code: i32, message: String },
18
19 #[error("JSON parsing failed: {0}")]
21 Json(#[from] serde_json::Error),
22
23 #[error("Hex decoding failed: {0}")]
25 Hex(#[from] hex::FromHexError),
26
27 #[error("Bitcoin SV parsing failed: {0}")]
29 BitcoinSv(String),
30
31 #[error("Invalid URL: {0}")]
33 InvalidUrl(String),
34
35 #[error("Authentication required but credentials not provided")]
37 AuthRequired,
38
39 #[error("Invalid configuration: {0}")]
41 Config(String),
42
43 #[error("Error: {0}")]
45 Other(String),
46}