c-api: Avoid losing error context with instance traps (#5223)
This commit was a mistake from #5149
This commit is contained in:
@@ -98,13 +98,14 @@ pub(crate) fn handle_instantiate(
|
||||
*instance_ptr = i;
|
||||
None
|
||||
}
|
||||
Err(e) => match e.downcast::<Trap>() {
|
||||
Ok(trap) => {
|
||||
*trap_ptr = Box::into_raw(Box::new(wasm_trap_t::new(trap.into())));
|
||||
Err(e) => {
|
||||
if e.is::<Trap>() {
|
||||
*trap_ptr = Box::into_raw(Box::new(wasm_trap_t::new(e)));
|
||||
None
|
||||
} else {
|
||||
Some(Box::new(e.into()))
|
||||
}
|
||||
Err(e) => Some(Box::new(e.into())),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user