use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("LDK Node error: {0}")]
LdkNode(#[from] ldk_node::NodeError),
#[error("LDK Build error: {0}")]
LdkBuild(#[from] ldk_node::BuildError),
#[error("Invalid description")]
InvalidDescription,
#[error("Invalid payment hash")]
InvalidPaymentHash,
#[error("Invalid payment hash length")]
InvalidPaymentHashLength,
#[error("Invalid payment ID length")]
InvalidPaymentIdLength,
#[error("Unknown invoice amount")]
UnknownInvoiceAmount,
#[error("Could not send bolt11 payment")]
CouldNotSendBolt11,
#[error("Could not send bolt11 without amount")]
CouldNotSendBolt11WithoutAmount,
#[error("Payment not found")]
PaymentNotFound,
#[error("Could not get amount spent")]
CouldNotGetAmountSpent,
#[error("Could not get payment amount")]
CouldNotGetPaymentAmount,
#[error("Unexpected payment kind")]
UnexpectedPaymentKind,
#[error("Unsupported payment identifier type")]
UnsupportedPaymentIdentifierType,
#[error("Invalid payment direction")]
InvalidPaymentDirection,
#[error("Hex decode error: {0}")]
HexDecode(#[from] cdk_common::util::hex::Error),
#[error("JSON error: {0}")]
Json(#[from] serde_json::Error),
#[error("Amount conversion error: {0}")]
AmountConversion(#[from] cdk_common::amount::Error),
#[error("Invalid hex")]
InvalidHex,
}
impl From<Error> for cdk_common::payment::Error {
fn from(e: Error) -> Self {
Self::Lightning(Box::new(e))
}
}