use exonum::runtime::{ExecutionError, ExecutionFail};
use exonum_derive::*;
use std::fmt;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[non_exhaustive]
pub enum CommonError {
DeadlineExceeded = 0,
ActualFromIsPast = 1,
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[non_exhaustive]
pub enum ArtifactError {
AlreadyDeployed = 16,
InvalidArtifactId = 17,
DeployRequestAlreadyRegistered = 18,
DeployRequestNotRegistered = 19,
UnknownArtifact = 20,
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[non_exhaustive]
pub enum ServiceError {
InstanceExists = 32,
InvalidInstanceName = 33,
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[non_exhaustive]
pub enum ConfigurationError {
ConfigProposeExists = 48,
MalformedConfigPropose = 49,
ConfigProposeNotRegistered = 50,
AttemptToVoteTwice = 51,
IncorrectConfigurationNumber = 52,
InvalidConfig = 53,
}
impl ConfigurationError {
pub(crate) fn malformed_propose(description: impl fmt::Display) -> ExecutionError {
Self::MalformedConfigPropose.with_description(description)
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[non_exhaustive]
pub enum MigrationError {
MigrationRequestNotRegistered = 64,
MigrationFailed = 65,
StateHashDivergence = 66,
}