cdk_cln/
error.rs

1//! CLN Errors
2
3use thiserror::Error;
4
5/// CLN Error
6#[derive(Debug, Error)]
7pub enum Error {
8    /// Invoice amount not defined
9    #[error("Unknown invoice amount")]
10    UnknownInvoiceAmount,
11    /// Wrong CLN response
12    #[error("Wrong CLN response")]
13    WrongClnResponse,
14    /// Unknown invoice
15    #[error("Unknown invoice")]
16    UnknownInvoice,
17    /// Invalid payment hash
18    #[error("Invalid hash")]
19    InvalidHash,
20    /// Cln Error
21    #[error(transparent)]
22    Cln(#[from] cln_rpc::Error),
23    /// Cln Rpc Error
24    #[error(transparent)]
25    ClnRpc(#[from] cln_rpc::RpcError),
26    /// Amount Error
27    #[error(transparent)]
28    Amount(#[from] cdk_common::amount::Error),
29}
30
31impl From<Error> for cdk_common::payment::Error {
32    fn from(e: Error) -> Self {
33        Self::Lightning(Box::new(e))
34    }
35}