Files
cdk/crates/cdk-cln/src/error.rs
David Caseria fc0cc6789c Refactor to_unit into amount module (#381)
* Refactor to_unit into amount module
2024-10-01 14:36:37 +02:00

36 lines
809 B
Rust

//! CLN Errors
use thiserror::Error;
/// CLN Error
#[derive(Debug, Error)]
pub enum Error {
/// Invoice amount not defined
#[error("Unknown invoice amount")]
UnknownInvoiceAmount,
/// Wrong CLN response
#[error("Wrong CLN response")]
WrongClnResponse,
/// Unknown invoice
#[error("Unknown invoice")]
UnknownInvoice,
/// Invalid payment hash
#[error("Invalid hash")]
InvalidHash,
/// Cln Error
#[error(transparent)]
Cln(#[from] cln_rpc::Error),
/// Cln Rpc Error
#[error(transparent)]
ClnRpc(#[from] cln_rpc::RpcError),
/// Amount Error
#[error(transparent)]
Amount(#[from] cdk::amount::Error),
}
impl From<Error> for cdk::cdk_lightning::Error {
fn from(e: Error) -> Self {
Self::Lightning(Box::new(e))
}
}