radix_wasmi/func/
error.rs1use core::{fmt, fmt::Display};
2
3#[derive(Debug)]
5pub enum FuncError {
6 ExportedFuncNotFound,
8 MismatchingParameterType,
10 MismatchingParameterLen,
12 MismatchingResultType,
14 MismatchingResultLen,
16}
17
18impl Display for FuncError {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 match self {
21 FuncError::ExportedFuncNotFound => {
22 write!(f, "could not find exported function")
23 }
24 FuncError::MismatchingParameterType => {
25 write!(f, "encountered incorrect function parameter type")
26 }
27 FuncError::MismatchingParameterLen => {
28 write!(f, "encountered an incorrect number of parameters")
29 }
30 FuncError::MismatchingResultType => {
31 write!(f, "encountered incorrect function result type")
32 }
33 FuncError::MismatchingResultLen => {
34 write!(f, "encountered an incorrect number of results")
35 }
36 }
37 }
38}