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

@@ -133,9 +133,9 @@ impl CompilationArtifacts {
}
let obj = obj.write().map_err(|_| {
SetupError::Instantiate(InstantiationError::Resource(
"failed to create image memory".to_string(),
))
SetupError::Instantiate(InstantiationError::Resource(anyhow::anyhow!(
"failed to create image memory"
)))
})?;
Ok(CompilationArtifacts {
@@ -236,7 +236,7 @@ impl CompiledModule {
&artifacts.unwind_info,
)
.map_err(|message| {
SetupError::Instantiate(InstantiationError::Resource(format!(
SetupError::Instantiate(InstantiationError::Resource(anyhow::anyhow!(
"failed to build code memory for functions: {}",
message
)))