soroban_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
18#[cfg(feature = "std")]
19impl std::error::Error for FuncError {}
20
21impl Display for FuncError {
22 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
23 match self {
24 FuncError::ExportedFuncNotFound => {
25 write!(f, "could not find exported function")
26 }
27 FuncError::MismatchingParameterType => {
28 write!(f, "encountered incorrect function parameter type")
29 }
30 FuncError::MismatchingParameterLen => {
31 write!(f, "encountered an incorrect number of parameters")
32 }
33 FuncError::MismatchingResultType => {
34 write!(f, "encountered incorrect function result type")
35 }
36 FuncError::MismatchingResultLen => {
37 write!(f, "encountered an incorrect number of results")
38 }
39 }
40 }
41}