Skip to content

Commit f83f8cf

Browse files
aheejinioannad
authored andcommitted
Rethrow/br_on_exn traps when given nullref (WebAssembly#97)
Following the discussions in WebAssembly#90, it seems desirable and less error-prone to make `rethrow` and `br_on_exn` trap in case the value on top of the stack is of `nullref` type. Closes WebAssembly#90.
1 parent 8225dab commit f83f8cf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

proposals/Exceptions.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ Note that a caught exception can be rethrown using the `rethrow` instruction.
217217
The `rethrow` instruction takes the exception associated with the `exnref` on
218218
top of the stack, and rethrows the exception. A rethrow has the same effect as a
219219
throw, other than an exception is not created. Rather, the referenced exception
220-
on top of the stack is popped and then thrown.
220+
on top of the stack is popped and then thrown. The `rethrow` instruction traps
221+
if the value on the top of the stack is null.
221222

222223
### Exception data extraction
223224

@@ -271,7 +272,8 @@ end $end
271272
```
272273

273274
If the query fails, the control flow falls through, and no values are pushed
274-
onto the stack.
275+
onto the stack. The `br_on_exn` instruction traps if the value on the top of the
276+
stack is null.
275277

276278
### Stack traces
277279

0 commit comments

Comments
 (0)