error.rs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //! SQLite Wallet Error
  2. use thiserror::Error;
  3. /// SQLite Wallet Error
  4. #[derive(Debug, Error)]
  5. pub enum Error {
  6. /// SQLX Error
  7. #[error(transparent)]
  8. SQLX(#[from] sqlx::Error),
  9. /// Serde Error
  10. #[error(transparent)]
  11. Serde(#[from] serde_json::Error),
  12. /// NUT00 Error
  13. #[error(transparent)]
  14. CDKNUT00(#[from] cdk_common::nuts::nut00::Error),
  15. /// NUT01 Error
  16. #[error(transparent)]
  17. CDKNUT01(#[from] cdk_common::nuts::nut01::Error),
  18. /// NUT02 Error
  19. #[error(transparent)]
  20. CDKNUT02(#[from] cdk_common::nuts::nut02::Error),
  21. /// NUT04 Error
  22. #[error(transparent)]
  23. CDKNUT04(#[from] cdk_common::nuts::nut04::Error),
  24. /// NUT05 Error
  25. #[error(transparent)]
  26. CDKNUT05(#[from] cdk_common::nuts::nut05::Error),
  27. /// NUT07 Error
  28. #[error(transparent)]
  29. CDKNUT07(#[from] cdk_common::nuts::nut07::Error),
  30. /// Secret Error
  31. #[error(transparent)]
  32. CDKSECRET(#[from] cdk_common::secret::Error),
  33. /// Mint Url
  34. #[error(transparent)]
  35. MintUrl(#[from] cdk_common::mint_url::Error),
  36. /// BIP32 Error
  37. #[error(transparent)]
  38. BIP32(#[from] bitcoin::bip32::Error),
  39. /// Could Not Initialize Database
  40. #[error("Could not initialize database")]
  41. CouldNotInitialize,
  42. /// Invalid Database Path
  43. #[error("Invalid database path")]
  44. InvalidDbPath,
  45. }
  46. impl From<Error> for cdk_common::database::Error {
  47. fn from(e: Error) -> Self {
  48. Self::Database(Box::new(e))
  49. }
  50. }