error.rs 668 B

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