rustywallet_electrum/
error.rs1use thiserror::Error;
4
5#[derive(Debug, Error)]
7pub enum ElectrumError {
8 #[error("Connection failed: {0}")]
10 ConnectionFailed(String),
11
12 #[error("Connection timeout")]
14 Timeout,
15
16 #[error("Server error ({code}): {message}")]
18 ServerError {
19 code: i32,
21 message: String,
23 },
24
25 #[error("Invalid address: {0}")]
27 InvalidAddress(String),
28
29 #[error("Invalid response: {0}")]
31 InvalidResponse(String),
32
33 #[error("TLS error: {0}")]
35 TlsError(String),
36
37 #[error("I/O error: {0}")]
39 IoError(#[from] std::io::Error),
40
41 #[error("JSON error: {0}")]
43 JsonError(#[from] serde_json::Error),
44
45 #[error("Request ID mismatch: expected {expected}, got {got}")]
47 IdMismatch {
48 expected: u64,
50 got: u64,
52 },
53
54 #[error("Server disconnected")]
56 Disconnected,
57
58 #[error("Invalid scripthash: {0}")]
60 InvalidScripthash(String),
61}
62
63pub type Result<T> = std::result::Result<T, ElectrumError>;