error.rs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //! Redb Error
  2. use std::num::ParseIntError;
  3. use thiserror::Error;
  4. /// Redb Database Error
  5. #[derive(Debug, Error)]
  6. pub enum Error {
  7. /// Redb Error
  8. #[error(transparent)]
  9. Redb(#[from] redb::Error),
  10. /// Redb Database Error
  11. #[error(transparent)]
  12. Database(#[from] redb::DatabaseError),
  13. /// Redb Transaction Error
  14. #[error(transparent)]
  15. Transaction(#[from] redb::TransactionError),
  16. /// Redb Commit Error
  17. #[error(transparent)]
  18. Commit(#[from] redb::CommitError),
  19. /// Redb Table Error
  20. #[error(transparent)]
  21. Table(#[from] redb::TableError),
  22. /// Redb Storage Error
  23. #[error(transparent)]
  24. Storage(#[from] redb::StorageError),
  25. /// Serde Json Error
  26. #[error(transparent)]
  27. Serde(#[from] serde_json::Error),
  28. /// Parse int Error
  29. #[error(transparent)]
  30. ParseInt(#[from] ParseIntError),
  31. /// CDK Database Error
  32. #[error(transparent)]
  33. CDKDatabase(#[from] cdk_common::database::Error),
  34. /// CDK Mint Url Error
  35. #[error(transparent)]
  36. CDKMintUrl(#[from] cdk_common::mint_url::Error),
  37. /// CDK Error
  38. #[error(transparent)]
  39. CDK(#[from] cdk_common::error::Error),
  40. /// NUT00 Error
  41. #[error(transparent)]
  42. CDKNUT00(#[from] cdk_common::nuts::nut00::Error),
  43. /// NUT02 Error
  44. #[error(transparent)]
  45. CDKNUT02(#[from] cdk_common::nuts::nut02::Error),
  46. /// DHKE Error
  47. #[error(transparent)]
  48. DHKE(#[from] cdk_common::dhke::Error),
  49. /// Unknown Mint Info
  50. #[error("Unknown mint info")]
  51. UnknownMintInfo,
  52. /// Unknown quote ttl
  53. #[error("Unknown quote ttl")]
  54. UnknownQuoteTTL,
  55. /// Unknown Proof Y
  56. #[error("Unknown proof Y")]
  57. UnknownY,
  58. /// Unknown Quote
  59. #[error("Unknown quote")]
  60. UnknownQuote,
  61. /// Unknown Database Version
  62. #[error("Unknown database version")]
  63. UnknownDatabaseVersion,
  64. }
  65. impl From<Error> for cdk_common::database::Error {
  66. fn from(e: Error) -> Self {
  67. Self::Database(Box::new(e))
  68. }
  69. }