use exonum_derive::ExecutionFail;
use crate::runtime::{ExecutionError, ExecutionFail};
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[execution_fail(crate = "crate", kind = "core")]
#[non_exhaustive]
pub enum CoreError {
IncorrectRuntime = 0,
UnknownArtifactId = 1,
ArtifactAlreadyDeployed = 2,
ArtifactNotDeployed = 3,
ServiceNameExists = 4,
ServiceIdExists = 5,
ServiceNotActive = 6,
IncorrectInstanceId = 7,
StackOverflow = 8,
ServicePending = 9,
InvalidServiceTransition = 10,
CannotUpgradeService = 11,
NoMigration = 12,
CannotResumeService = 13,
IncorrectCall = 14,
CannotUnloadArtifact = 15,
}
impl CoreError {
pub(crate) fn stack_overflow(max_depth: u64) -> ExecutionError {
let description = format!(
"Maximum depth of call stack ({}) has been reached.",
max_depth
);
Self::StackOverflow.with_description(description)
}
}