CONCEPT Cited by 1 source
WebAssembly Exception Handling¶
Definition¶
WebAssembly Exception Handling is a Wasm specification
proposal adding structured exception primitives — try,
catch, catch_all, throw, rethrow — to the Wasm
instruction set. Without it, Wasm had no portable way to
unwind; the only failure primitive was unreachable, which
traps and exits to the embedder.
The proposal reached wide engine support in 2023 and is
the primitive underneath Rust's
panic=unwind on
wasm32-unknown-unknown and C++ exceptions compiled to Wasm.
Two variants¶
During the proposal's development a late-stage specification change produced two wire-compatible variants:
- Legacy exception handling — the initial variant (proposals/exception-handling/legacy/Exceptions.md). Widely supported; now deprecated.
- Modern exception handling "with exnref" — the final variant (proposals/exception-handling/Exceptions.md) using a reference type for caught exceptions.
As of the 2026-04-22 Cloudflare post, Rust's Wasm targets still default to the legacy variant; Cloudflare is working to make modern the default "next year."
Engine support for modern EH¶
| Runtime | Version | Released |
|---|---|---|
| V8 (systems/v8-javascript-engine) | 13.8.1 | 2025-04-28 |
| workerd (systems/workerd) | v1.20250620.0 | 2025-06-19 |
| Chrome | 138 | 2025-06-28 |
| Firefox | 131 | 2024-10-01 |
| Safari | 18.4 | 2025-03-31 |
| Node.js (systems/nodejs) | 25.0.0 | 2025-10-15 |
Node.js backport as enabling step¶
Node.js 24 LTS was the constraint — its release schedule would have kept the ecosystem on legacy EH until April 2028. Cloudflare backported modern EH to Node.js 24 and Node.js 22 so modern EH becomes viable as a default target. "This should allow the modern Exception Handling proposal to become the default target next year." Canonical wiki instance of patterns/upstream-the-fix at the Wasm-engine layer.
What wasm-bindgen uses EH for¶
Cloudflare's 2026-04 work in systems/wasm-bindgen leverages Wasm EH to:
- Compile Rust destructors into
catch_allblocks that fire on unwind. - Compile
std::panic::catch_unwind(|| …)into nestedtry/catchpairs. - Surface panics at the Rust↔JS boundary as JavaScript
PanicErrorexceptions. - Introduce an
Exception.Tagfor foreign exceptions to distinguish recoverable unwinds from non-unwindable aborts (see concepts/abort-recovery).
"Since our foreign exception handling was directly using raw WAT-level (WebAssembly text format) Exception Handling instructions already, we found it easier to implement exception tags for foreign exceptions to distinguish them from aborting non-unwind-safe exceptions."
Seen in¶
- sources/2026-04-22-cloudflare-making-rust-workers-reliable-panic-and-abort-recovery-in-wasm-bindgen — canonical wiki instance. Wasm EH as the primitive Cloudflare builds Rust panic + abort recovery on top of, with concrete engine-support matrix and Node.js backport details.
Related¶
- concepts/panic-unwind — the Rust-level primitive Wasm
EH enables on
wasm32-unknown-unknown. - concepts/panic-abort — the Rust-on-Wasm default before EH was usable.
- concepts/stack-unwinding — the general runtime operation Wasm EH makes possible on this substrate.
- concepts/abort-recovery — uses Wasm EH's
Exception.Tagto distinguish recoverable from non-recoverable failures at the JS boundary. - systems/webassembly — the substrate.
- systems/wasm-bindgen — the Rust-side consumer that turned this primitive into production panic recovery.
- systems/v8-javascript-engine / systems/workerd / systems/nodejs — the engines shipping modern EH.