use exonum_derive::ExecutionFail;
use std::fmt::Display;
use crate::runtime::{ExecutionError, ExecutionFail};
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[derive(ExecutionFail)]
#[execution_fail(crate = "crate", kind = "common")]
#[non_exhaustive]
pub enum CommonError {
NoSuchInterface = 0,
NoSuchMethod = 1,
UnauthorizedCaller = 2,
MalformedArguments = 3,
MethodRemoved = 4,
FeatureNotSupported = 5,
}
impl CommonError {
pub fn malformed_arguments(cause: impl Display) -> ExecutionError {
let description = format!(
"Malformed arguments for calling a service interface method: {}",
cause
);
Self::MalformedArguments.with_description(description)
}
}