Use anyhow::Error in instantiation errors.

This commit updates the error enums used in instantiation errors to encapsulate
an `anyhow::Error` rather than a string.
This commit is contained in:
Peter Huene
2021-03-08 09:30:13 -08:00
parent 5fa0f8d469
commit 623290d42e
4 changed files with 14 additions and 14 deletions

View File

@@ -38,7 +38,9 @@ pub fn make_trampoline(
assert!(compiled_function.relocations.is_empty());
let ptr = code_memory
.allocate_for_function(&compiled_function)
.map_err(|message| SetupError::Instantiate(InstantiationError::Resource(message)))?
.map_err(|message| {
SetupError::Instantiate(InstantiationError::Resource(anyhow::anyhow!(message)))
})?
.as_ptr();
Ok(unsafe { std::mem::transmute::<*const VMFunctionBody, VMTrampoline>(ptr) })
}