I have tried to build WASM for wasm32-unknown-unknown but found that catch_unwind is not working properly. How do I use catch_unwind in WASM? Do I need wasm32-wasmi to make catch_unwind work?
Wasm exception support isn't yet supported by wasmtime. And to compile for wasm exceptions with rustc, I think you currently need to do something likeRUSTFLAGS="-Cpanic=unwind" cargo build -Zbuild-std --target wasm32-unknown-unknown with nightly rustc to rebuild the standard library with exception support.
Does wasmtime have a time plan for this feature?
Yes, it is currently being implemented.
You will likely need nightly rustc for a while though.
bjorn3 said:
Yes, it is currently being implemented.
Thanks for the instruction. I managed to build an unwind wasm. But when I ran it with wasmtime, I got an error exceptions proposal not enabled (at offset 0xe2). So will exception support be added in wasmtime soon?
Yeah, that is what I meant. It currently isn't implemented yet, but someone is working on the Cranelift changes necessary for implementing exception support in Wasmtime.
Last updated: Dec 06 2025 at 05:03 UTC