error.rs 894 B

123456789101112131415161718192021222324252627282930
  1. use crate::{amount, asset::AssetId, storage, transaction, AccountId};
  2. use serde::Serialize;
  3. /// The errors that can happen in the Verax crate
  4. #[derive(thiserror::Error, Debug, Serialize)]
  5. pub enum Error {
  6. /// A transaction error
  7. #[error("Transaction: {0}")]
  8. Transaction(#[from] transaction::Error),
  9. /// A storage error
  10. #[error("Storage: {0}")]
  11. Storage(#[from] storage::Error),
  12. /// The asset is not defined
  13. #[error("Asset {0} is not defined")]
  14. AssetIdNotFound(AssetId),
  15. /// The asset is not found
  16. #[error("Asset {0} is not defined")]
  17. AssetNotFound(String),
  18. /// The account has not enough balance to perform the operation
  19. #[error("Not enough funds (asset {1}) for account {0}")]
  20. InsufficientBalance(AccountId, AssetId),
  21. /// The amount is invalid
  22. #[error("Invalid amount: {0}")]
  23. InvalidAmount(#[from] amount::Error),
  24. }