bitceptron_retriever/
error.rs

1#[derive(Debug)]
2pub enum RetrieverError {
3    BitcoincoreRpcCrateError(bitcoincore_rpc::Error),
4    JsonRpcHttpError(bitcoincore_rpc::jsonrpc::simple_http::Error),
5    BitcoincoreRpcUnreachable,
6    DumpFileAlreadyExistsInPath,
7    IoError(std::io::Error),
8    ConsensusEncodeError(bitcoincore_rpc::bitcoin::consensus::encode::Error),
9    InvalidExplorationPath,
10    Bip32Error(bitcoin::bip32::Error),
11    InvalidStepRange,
12    Bip39Error(bip39::Error),
13    MiniscriptError(miniscript::Error),
14    Secp256k1Error(bitcoin::secp256k1::Error),
15    NoDumpFileInDataDir,
16    UnspentScriptPublicKeySetIsNotPopulated,
17    NoSearchHasBeenPerformed,
18    DetailsHaveNotBeenFetched,
19    ConfigError(config::ConfigError),
20    TokioJoinError(tokio::task::JoinError),
21    PopulatingUSPKSetInProgress,
22    USPKSetAlreadyPopulated,
23}
24
25impl From<bitcoincore_rpc::Error> for RetrieverError {
26    fn from(value: bitcoincore_rpc::Error) -> Self {
27        RetrieverError::BitcoincoreRpcCrateError(value)
28    }
29}
30
31impl From<bitcoincore_rpc::jsonrpc::simple_http::Error> for RetrieverError {
32    fn from(value: bitcoincore_rpc::jsonrpc::simple_http::Error) -> Self {
33        RetrieverError::JsonRpcHttpError(value)
34    }
35}
36
37impl From<std::io::Error> for RetrieverError {
38    fn from(value: std::io::Error) -> Self {
39        RetrieverError::IoError(value)
40    }
41}
42
43impl From<bitcoincore_rpc::bitcoin::consensus::encode::Error> for RetrieverError {
44    fn from(value: bitcoincore_rpc::bitcoin::consensus::encode::Error) -> Self {
45        RetrieverError::ConsensusEncodeError(value)
46    }
47}
48
49impl From<bitcoin::bip32::Error> for RetrieverError {
50    fn from(value: bitcoin::bip32::Error) -> Self {
51        RetrieverError::Bip32Error(value)
52    }
53}
54
55impl From<bip39::Error> for RetrieverError {
56    fn from(value: bip39::Error) -> Self {
57        RetrieverError::Bip39Error(value)
58    }
59}
60
61impl From<miniscript::Error> for RetrieverError {
62    fn from(value: miniscript::Error) -> Self {
63        RetrieverError::MiniscriptError(value)
64    }
65}
66
67impl From<bitcoin::secp256k1::Error> for RetrieverError {
68    fn from(value: bitcoin::secp256k1::Error) -> Self {
69        RetrieverError::Secp256k1Error(value)
70    }
71}
72
73impl From<config::ConfigError> for RetrieverError {
74    fn from(value: config::ConfigError) -> Self {
75        RetrieverError::ConfigError(value)
76    }
77}
78
79impl From<tokio::task::JoinError> for RetrieverError {
80    fn from(value: tokio::task::JoinError) -> Self {
81        RetrieverError::TokioJoinError(value)
82    }
83}