From 78c1e4032f2b96c5752e498bdd9b798ab25b62c2 Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Thu, 26 Aug 2021 07:18:43 -0700 Subject: [PATCH] Include the function name in `Instance::get_typed_func` error context (#3243) --- crates/wasmtime/src/instance.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/wasmtime/src/instance.rs b/crates/wasmtime/src/instance.rs index 2e23e79505..bc66d0308c 100644 --- a/crates/wasmtime/src/instance.rs +++ b/crates/wasmtime/src/instance.rs @@ -372,7 +372,8 @@ impl Instance { .get_export(store.as_context_mut(), name) .and_then(|f| f.into_func()) .ok_or_else(|| anyhow!("failed to find function export `{}`", name))?; - Ok(f.typed::(store)?) + Ok(f.typed::(store) + .with_context(|| format!("failed to convert function `{}` to given type", name))?) } /// Looks up an exported [`Table`] value by name.