error.rs 741 B

1234567891011121314151617181920212223242526272829303132
  1. //! Error for phoenixd ln backend
  2. use thiserror::Error;
  3. /// Phoenixd 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. /// Unsupported unit
  13. #[error("Unit Unsupported")]
  14. UnsupportedUnit,
  15. /// Amount overflow
  16. #[error("Amount overflow")]
  17. AmountOverflow,
  18. /// phd error
  19. #[error(transparent)]
  20. Phd(#[from] phoenixd_rs::Error),
  21. /// Anyhow error
  22. #[error(transparent)]
  23. Anyhow(#[from] anyhow::Error),
  24. }
  25. impl From<Error> for cdk::cdk_lightning::Error {
  26. fn from(e: Error) -> Self {
  27. Self::Lightning(Box::new(e))
  28. }
  29. }