use crate::{amount, asset::Asset, storage, transaction, AccountId}; use serde::Serialize; /// The errors that can happen in the Verax crate #[derive(thiserror::Error, Debug, Serialize)] pub enum Error { /// A transaction error #[error("Transaction: {0}")] Transaction(#[from] transaction::Error), /// An internal conversion error #[error("Conversion overflow: {0}")] Overflow(String), /// An internal conversion error #[error("Conversion overflow: {0}")] Underflow(String), /// A storage error #[error("Storage: {0}")] Storage(#[from] storage::Error), /// The asset is not defined #[error("Asset {0} is not defined")] AssetIdNotFound(Asset), /// The asset is not found #[error("Asset {0} is not defined")] AssetNotFound(String), /// The account has not enough balance to perform the operation #[error("Not enough funds (asset {1}) for account {0}")] InsufficientBalance(AccountId, Asset), /// The amount is invalid #[error("Invalid amount: {0}")] InvalidAmount(#[from] amount::Error), }