Include the function name in Instance::get_typed_func error context (#3243)

This commit is contained in:
Nick Fitzgerald
2021-08-26 07:18:43 -07:00
committed by GitHub
parent 6fbddc1931
commit 78c1e4032f

View File

@@ -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::<Params, Results, _>(store)?)
Ok(f.typed::<Params, Results, _>(store)
.with_context(|| format!("failed to convert function `{}` to given type", name))?)
}
/// Looks up an exported [`Table`] value by name.