cdk_lnbits/error.rs
1//! Error for LNbits ln backend
2
3use thiserror::Error;
4
5/// LNbits Error
6#[derive(Debug, Error)]
7pub enum Error {
8 /// Invoice amount not defined
9 #[error("Unknown invoice amount")]
10 UnknownInvoiceAmount,
11 /// Unknown invoice
12 #[error("Unknown invoice")]
13 UnknownInvoice,
14 /// Amount overflow
15 #[error("Amount overflow")]
16 AmountOverflow,
17 /// Invalid payment hash
18 #[error("Invalid payment hash")]
19 InvalidPaymentHash,
20 /// Anyhow error
21 #[error(transparent)]
22 Anyhow(#[from] anyhow::Error),
23}
24
25impl From<Error> for cdk_common::payment::Error {
26 fn from(e: Error) -> Self {
27 Self::Lightning(Box::new(e))
28 }
29}