alexcrichton opened issue #13304:
This input:
use wasmtime::*; fn main() -> wasmtime::Result<()> { let mut config = Config::new(); config.wasm_exceptions(true); let engine = Engine::new(&config)?; let mut store = Store::new(&engine, ()); let host_fn = Func::wrap(&mut store, || -> Result<()> { Err(ThrownException.into()) }); let wat = r#" (module (import "" "host" (func $host)) (func (export "go") call $host) ) "#; let module = Module::new(&engine, wat::parse_str(wat)?)?; let instance = Instance::new(&mut store, &module, &[host_fn.into()])?; let go = instance.get_typed_func::<(), ()>(&mut store, "go")?; let result = go.call(&mut store, ()); println!("result = {result:?}"); Ok(()) }yields:
$ cargo run -q thread 'main' (2337993) panicked at /home/alex/code/wasmtime2/crates/wasmtime/src/runtime/vm/throw.rs:23:10: Only invoked when an exception is pending note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' (2337993) panicked at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/panicking.rs:225:5: panic in a function that cannot unwind stack backtrace: ... (big long backtrace)
alexcrichton added the wasm-proposal:exceptions label to Issue #13304.
alexcrichton assigned alexcrichton to issue #13304.
alexcrichton closed issue #13304:
This input:
use wasmtime::*; fn main() -> wasmtime::Result<()> { let mut config = Config::new(); config.wasm_exceptions(true); let engine = Engine::new(&config)?; let mut store = Store::new(&engine, ()); let host_fn = Func::wrap(&mut store, || -> Result<()> { Err(ThrownException.into()) }); let wat = r#" (module (import "" "host" (func $host)) (func (export "go") call $host) ) "#; let module = Module::new(&engine, wat::parse_str(wat)?)?; let instance = Instance::new(&mut store, &module, &[host_fn.into()])?; let go = instance.get_typed_func::<(), ()>(&mut store, "go")?; let result = go.call(&mut store, ()); println!("result = {result:?}"); Ok(()) }yields:
$ cargo run -q thread 'main' (2337993) panicked at /home/alex/code/wasmtime2/crates/wasmtime/src/runtime/vm/throw.rs:23:10: Only invoked when an exception is pending note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'main' (2337993) panicked at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/core/src/panicking.rs:225:5: panic in a function that cannot unwind stack backtrace: ... (big long backtrace)
Last updated: Jun 01 2026 at 09:49 UTC