rustywallet_lightning/
error.rs

1//! Error types for Lightning Network operations.
2
3use thiserror::Error;
4
5/// Errors that can occur during Lightning operations.
6#[derive(Debug, Error)]
7pub enum LightningError {
8    /// Invalid format (generic).
9    #[error("Invalid format: {0}")]
10    InvalidFormat(String),
11
12    /// Invalid BOLT11 invoice format.
13    #[error("Invalid BOLT11 invoice: {0}")]
14    InvalidInvoice(String),
15
16    /// Invalid payment hash.
17    #[error("Invalid payment hash: {0}")]
18    InvalidPaymentHash(String),
19
20    /// Invalid preimage.
21    #[error("Invalid preimage: {0}")]
22    InvalidPreimage(String),
23
24    /// Invalid node ID.
25    #[error("Invalid node ID: {0}")]
26    InvalidNodeId(String),
27
28    /// Invalid channel point.
29    #[error("Invalid channel point: {0}")]
30    InvalidChannelPoint(String),
31
32    /// Invalid route hint.
33    #[error("Invalid route hint: {0}")]
34    InvalidRouteHint(String),
35
36    /// Bech32 encoding/decoding error.
37    #[error("Bech32 error: {0}")]
38    Bech32Error(String),
39
40    /// Key derivation error.
41    #[error("Key derivation error: {0}")]
42    KeyDerivationError(String),
43
44    /// Signature error.
45    #[error("Signature error: {0}")]
46    SignatureError(String),
47
48    /// Invoice expired.
49    #[error("Invoice expired")]
50    InvoiceExpired,
51
52    /// Amount mismatch.
53    #[error("Amount mismatch: expected {expected}, got {actual}")]
54    AmountMismatch { expected: u64, actual: u64 },
55}