Expand description
Shared emission for raising a catchable Error: the native-throw tail
used by every wasm throw site (user throw, array bounds, as cast
mismatch, JSON shape mismatch), plus the TypeError and ReferenceError
raises built on it and their messages.
A throw whose message belongs to one subsystem keeps its constructor and
constant there — bounds::emit_index_oob_throw does. What lands here is
what has no better home: the shared tail, and messages raised from emitters
that don’t own a module of their own.
Every constant here must also be interned by codegen::analysis. The throw
reads its message out of the string pool; a missing entry is an internal
compile failure rather than a guest exception.
Constants§
- MISSING_
RETURN_ VALUE_ MESSAGE - Thrown when a function that must return a value reaches its end. The
missing-return rule leaves that possible only through an exhaustive
switchwhose value a call or closure moved outside the type a narrowing gave it. JavaScript returnsundefinedthere, which the declared return type cannot hold. - NON_
NULL_ ASSERT_ MESSAGE - Thrown by
x!when the value turns out to benullorundefined. - READ_
ONLY_ PROPERTY_ MESSAGE - Thrown when a property write resolves, at runtime, to a getter with no setter — reachable only through a receiver whose static type does not say which implementation backs the property.