-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patherrors.rs
More file actions
87 lines (74 loc) · 2.81 KB
/
Copy patherrors.rs
File metadata and controls
87 lines (74 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use thiserror::Error;
#[derive(uniffi::Error, Debug, Error)]
#[non_exhaustive]
pub enum AddressError {
#[error("Invalid Bitcoin address format")]
InvalidAddress,
#[error("Invalid network type")]
InvalidNetwork,
#[error("Mnemonic generation failed")]
MnemonicGenerationFailed,
#[error("Invalid mnemonic format")]
InvalidMnemonic,
#[error("Invalid entropy")]
InvalidEntropy,
#[error("Address derivation failed")]
AddressDerivationFailed,
}
#[derive(uniffi::Error, Debug, Error)]
#[non_exhaustive]
pub enum SweepError {
#[error("Sweep operation failed: {0}")]
SweepFailed(String),
#[error("No UTXOs found to sweep")]
NoUtxosFound,
#[error("Invalid mnemonic format")]
InvalidMnemonic,
}
#[derive(uniffi::Error, Debug, Error)]
#[non_exhaustive]
pub enum BroadcastError {
#[error("Invalid transaction hex: {error_details}")]
InvalidHex { error_details: String },
#[error("Invalid transaction data: {error_details}")]
InvalidTransaction { error_details: String },
#[error("Electrum error: {error_details}")]
ElectrumError { error_details: String },
#[error("Task error: {error_details}")]
TaskError { error_details: String },
}
/// Errors specific to account info operations (BDK/Electrum-based).
#[derive(uniffi::Error, Debug, Error)]
#[non_exhaustive]
pub enum AccountInfoError {
/// The provided extended public key is invalid or cannot be parsed
#[error("Invalid extended public key: {error_details}")]
InvalidExtendedKey { error_details: String },
/// The provided address is invalid
#[error("Invalid address: {error_details}")]
InvalidAddress { error_details: String },
/// Electrum connection or query failed
#[error("Electrum connection failed: {error_details}")]
ElectrumError { error_details: String },
/// BDK wallet creation or operation error
#[error("Wallet error: {error_details}")]
WalletError { error_details: String },
/// Wallet sync with Electrum failed
#[error("Sync failed: {error_details}")]
SyncError { error_details: String },
/// The key type/prefix is not recognized
#[error("Unsupported key type: {error_details}")]
UnsupportedKeyType { error_details: String },
/// Network mismatch between key prefix and specified network
#[error("Network mismatch: {error_details}")]
NetworkMismatch { error_details: String },
/// Invalid transaction ID provided
#[error("Invalid transaction ID: {error_details}")]
InvalidTxid { error_details: String },
/// A valid transaction ID was not found in the wallet
#[error("Transaction not found: {error_details}")]
TransactionNotFound { error_details: String },
/// Watcher lifecycle or subscription error
#[error("Watcher error: {error_details}")]
WatcherError { error_details: String },
}