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 BOLT11 invoice format.
9    #[error("Invalid BOLT11 invoice: {0}")]
10    InvalidInvoice(String),
11
12    /// Invalid payment hash.
13    #[error("Invalid payment hash: {0}")]
14    InvalidPaymentHash(String),
15
16    /// Invalid preimage.
17    #[error("Invalid preimage: {0}")]
18    InvalidPreimage(String),
19
20    /// Invalid node ID.
21    #[error("Invalid node ID: {0}")]
22    InvalidNodeId(String),
23
24    /// Invalid channel point.
25    #[error("Invalid channel point: {0}")]
26    InvalidChannelPoint(String),
27
28    /// Invalid route hint.
29    #[error("Invalid route hint: {0}")]
30    InvalidRouteHint(String),
31
32    /// Bech32 encoding/decoding error.
33    #[error("Bech32 error: {0}")]
34    Bech32Error(String),
35
36    /// Key derivation error.
37    #[error("Key derivation error: {0}")]
38    KeyDerivationError(String),
39
40    /// Signature error.
41    #[error("Signature error: {0}")]
42    SignatureError(String),
43
44    /// Invoice expired.
45    #[error("Invoice expired")]
46    InvoiceExpired,
47
48    /// Amount mismatch.
49    #[error("Amount mismatch: expected {expected}, got {actual}")]
50    AmountMismatch { expected: u64, actual: u64 },
51}