use core::{fmt, fmt::Display};
#[derive(Debug)]
pub enum FuncError {
ExportedFuncNotFound,
MismatchingParameterType,
MismatchingParameterLen,
MismatchingResultType,
MismatchingResultLen,
}
impl Display for FuncError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
FuncError::ExportedFuncNotFound => {
write!(f, "could not find exported function")
}
FuncError::MismatchingParameterType => {
write!(f, "encountered incorrect function parameter type")
}
FuncError::MismatchingParameterLen => {
write!(f, "encountered an incorrect number of parameters")
}
FuncError::MismatchingResultType => {
write!(f, "encountered incorrect function result type")
}
FuncError::MismatchingResultLen => {
write!(f, "encountered an incorrect number of results")
}
}
}
}