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

@@ -485,7 +485,7 @@ impl InstancePool {
max_pages,
commit_memory_pages,
)
.map_err(|e| InstantiationError::Resource(e.to_string()))?,
.map_err(InstantiationError::Resource)?,
);
}
@@ -509,7 +509,7 @@ impl InstancePool {
let base = tables.next().unwrap();
commit_table_pages(base, max_elements as usize * mem::size_of::<*mut u8>())
.map_err(|e| InstantiationError::Resource(e.to_string()))?;
.map_err(InstantiationError::Resource)?;
instance
.tables
@@ -785,7 +785,7 @@ impl StackPool {
.add((index * self.stack_size) + self.page_size);
commit_stack_pages(bottom_of_stack, size_without_guard)
.map_err(|e| FiberStackError::Resource(e.to_string()))?;
.map_err(FiberStackError::Resource)?;
// The top of the stack should be returned
Ok(bottom_of_stack.add(size_without_guard))