use derive_more::Display;
pub use common::{CommonError, CommonErrorKind, OtherError, SilentError};
pub mod common;
pub mod prelude;
pub mod util;
pub const SECOND_LEVEL_ERROR_CODE_INTERVAL: u32 = 1000u32;
pub trait ErrorCode {
fn error_code(&self) -> u32;
}
#[derive(Debug, Clone, Copy, Eq, PartialEq, Display)]
pub enum ErrorKind {
Common,
AssetVault,
BalanceSnapshot,
BalanceSnapshotFactory,
Blockchain,
CoreRegistry,
DepositDetector,
SecretVault,
SecretVaultFactory,
WalletRegistry,
WalletRegistryFactory,
AssetCreatorDetector,
}
impl ErrorCode for ErrorKind {
fn error_code(&self) -> u32 {
match self {
Self::Common => 10000,
Self::AssetVault => 20000,
Self::BalanceSnapshot => 30000,
Self::BalanceSnapshotFactory => 40000,
Self::Blockchain => 50000,
Self::CoreRegistry => 60000,
Self::DepositDetector => 70000,
Self::SecretVault => 80000,
Self::SecretVaultFactory => 90000,
Self::WalletRegistry => 100000,
Self::WalletRegistryFactory => 110000,
Self::AssetCreatorDetector => 120000,
}
}
}