wasmerio / wasmer-js

Monorepo for Javascript WebAssembly packages by Wasmer

Home Page:https://wasmerio.github.io/wasmer-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vague "unreachable" errors when unwraping/calling except on a option value

FranklinWaller opened this issue · comments

When trying to unwrap on a value (or calling .except) the wasmer running panics (as it should) only with a very vague error:

Error: Error while running start function: RuntimeError: JsValue(RuntimeError: unreachable
RuntimeError: unreachable

The rust WASI code:

fn main() {
    let some_none_value: Option<String> = None;

    println!("Hello, world!");

    let value = some_none_value.expect("This should crash");

    println!("This will not execute {value}");
}

I've created a repo that exactly reproduces this problem (Just run node index.js):

https://github.com/FranklinWaller/wasmer-js-vague-errors

For completeness, the old version 0.6.0 did show the errors correctly:

https://github.com/FranklinWaller/wasmer-js-vague-errors/tree/feat/old-wasmer

Hello, world!
thread 'main' panicked at 'This should crash', src/main.rs:6:33
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
wasm://wasm/0085860e:1


RuntimeError: unreachable

So i am stupid. If you wrap it in a try catch and then call Wasi.getStdErr you actually get the same error