mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-06-16 14:31:22 +00:00
In debug mode log all imported uncaught exceptions
This commit updates the `--debug` output of `wasm-bindgen` from the CLI to catch all JS exceptions from imported functions, log such, and then rethrow. It's hoped that this can be used when necessary to learn more information about thrown exceptions and where an uncaught exception could be causing issues with Rust code. Closes #1176
This commit is contained in:
@ -2410,6 +2410,9 @@ impl<'a, 'b> SubContext<'a, 'b> {
|
||||
// Build up our shim's state, and we'll use that to guide whether we
|
||||
// actually emit an import here or not.
|
||||
let mut shim = Rust2Js::new(self.cx);
|
||||
if shim.cx.config.debug {
|
||||
shim.catch_and_rethrow(true);
|
||||
}
|
||||
shim.catch(import.catch)
|
||||
.variadic(import.variadic)
|
||||
.process(descriptor.unwrap_function())?;
|
||||
|
Reference in New Issue
Block a user