-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unhandled panics are swallowed, crashes wasm "runtime" #12
Comments
random dice
@jonathandturner could we pair on this? I think together we have a much bigger chance of solving this. I'm on GMT+2 and could generally make time on weekdays after 8pm. |
Copied from Discord:
Maybe the |
Ah, that could be. Adding a simple fix to see if that's what it is. |
Doesn't seem to help. Maybe we can replace |
@jonathandturner maybe we can clone https://github.com/rustwasm/console_error_panic_hook/blob/master/src/lib.rs and change it to call a JS function that can do more than just Otherwise we could try to intercept |
ping @jonathandturner - what do you think about my suggestion (previous comment)? |
It might be worth trying to turn the async run_nu fn into a sync one, using something like https://docs.rs/async_executors/0.3.0/async_executors/ Generally wasm-bindgen seems to handle sync functions better than async ones. Though it could also be worth investigating why the try/catch can't capture the rejected promise - that seems like a bug in wasm-bindgen. |
#63 hugely improve this. The runtime(?) still crashes, but at least the panic is now visible and a button helps to reload with a safe command. |
Running
random bool
panicks and only dumps that error withconsole.error
panicked at 'could not initialize thread_rng: getrandom: this target is not supported', /Users/jzaefferer/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.7.3/src/rngs/thread.rs:65:17
I guess the
console.error
comes from theconsole_error_panic_hook
crateIs there some way to have the
wasm.run_nu
Promise rejected instead, to handle the error in our "application" code?If not, can we deal with panics on the Rust side and forward them through the existing serialized error channel?
It also looks like something "exits" once this type of error occurs, and running other commands isn't possible anymore (a page reload helps).
The text was updated successfully, but these errors were encountered: