lightning_transaction_sync/
error.rs1use std::fmt;
9
10#[derive(Debug)]
11pub enum TxSyncError {
13 Failed,
15}
16
17impl std::error::Error for TxSyncError {}
18
19impl fmt::Display for TxSyncError {
20 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21 match *self {
22 Self::Failed => write!(f, "Failed to conduct transaction sync."),
23 }
24 }
25}
26
27#[derive(Debug)]
28pub(crate) enum InternalError {
29 Failed,
31 Inconsistency,
33}
34
35impl fmt::Display for InternalError {
36 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
37 match *self {
38 Self::Failed => write!(f, "Failed to conduct transaction sync."),
39 Self::Inconsistency => {
40 write!(f, "Encountered an inconsistency during transaction sync.")
41 },
42 }
43 }
44}
45
46impl std::error::Error for InternalError {}
47
48impl From<InternalError> for TxSyncError {
49 fn from(_e: InternalError) -> Self {
50 Self::Failed
51 }
52}
53
54#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
55impl From<esplora_client::Error> for TxSyncError {
56 fn from(_e: esplora_client::Error) -> Self {
57 Self::Failed
58 }
59}
60
61#[cfg(any(feature = "esplora-blocking", feature = "esplora-async"))]
62impl From<esplora_client::Error> for InternalError {
63 fn from(_e: esplora_client::Error) -> Self {
64 Self::Failed
65 }
66}
67
68#[cfg(feature = "electrum")]
69impl From<electrum_client::Error> for InternalError {
70 fn from(_e: electrum_client::Error) -> Self {
71 Self::Failed
72 }
73}
74
75#[cfg(feature = "electrum")]
76impl From<electrum_client::Error> for TxSyncError {
77 fn from(_e: electrum_client::Error) -> Self {
78 Self::Failed
79 }
80}