Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Commit 263af13

Browse files
committed
80-col wrapping
1 parent 6b59bb1 commit 263af13

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

proposals/exception-handling/Exceptions.md

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ may send values back to the suspended instruction, allowing the originating code
5959
to resume.
6060

6161
Exceptions are a special case of an event in that they never resume. Similarly,
62-
a throw instruction is the suspending event of an exception. The catch or unwind
63-
block associated with a try block defines how to handle the throw.
62+
a `throw` instruction is the suspending event of an exception. The catch or
63+
unwind block associated with a try block defines how to handle the throw.
6464

6565
WebAssembly events (i.e. exceptions) are defined by a new `event` section of a
6666
WebAssembly module. The event section is a list of declared events associated
@@ -93,8 +93,8 @@ Exception indices are used by:
9393
1. The `throw` instruction which creates a WebAssembly exception with the
9494
corresponding exception tag, and then throws it.
9595

96-
2. The `catch` instruction uses the tag to identify if the thrown exception is
97-
one it can catch. If true it pushes the corresponding argument values of the
96+
2. The `catch` clause uses the tag to identify if the thrown exception is one it
97+
can catch. If true it pushes the corresponding argument values of the
9898
exception onto the stack.
9999

100100
### Try-catch blocks
@@ -161,8 +161,8 @@ end
161161
```
162162

163163
The `unwind` block is meant to contain cleanup instructions, such as
164-
destructors, in case any instruction in the corresponding try block throws.
165-
In case an exception is caught by the `unwind` block, it becomes the catching
164+
destructors, in case any instruction in the corresponding try block throws. In
165+
case an exception is caught by the `unwind` block, it becomes the catching
166166
block.
167167

168168
The `end` instruction at the end of `unwind` block is special that it
@@ -197,19 +197,20 @@ try block of the catch/unwind block, since instructions in the body of the
197197
catch/unwind block are not in the body of the try block.
198198

199199
Once a catching try block is found for the thrown exception, the operand stack
200-
is popped back to the size the operand stack had when the try block was entered after possible block parameters were popped.
200+
is popped back to the size the operand stack had when the try block was entered
201+
after possible block parameters were popped.
201202

202-
Then in case of a try-catch block, tagged catch blocks are tried in the
203-
order they appear in the catching try block, until one matches. If a matched
204-
tagged catch block is found, control is transferred to the body of the catch
205-
block, and the data fields of the exception are pushed back onto the stack.
203+
Then in case of a try-catch block, tagged catch blocks are tried in the order
204+
they appear in the catching try block, until one matches. If a matched tagged
205+
catch block is found, control is transferred to the body of the catch block, and
206+
the data fields of the exception are pushed back onto the stack.
206207

207208
Otherwise, control is transferred to the body of the `catch_all` block, if any.
208209
However, unlike tagged catch blocks, the constructor arguments are not copied
209210
back onto the operand stack.
210211

211-
If no tagged catch blocks were matched, and the
212-
catching try block doesn't have a `catch_all` block, the exception is rethrown.
212+
If no tagged catch blocks were matched, and the catching try block doesn't have
213+
a `catch_all` block, the exception is rethrown.
213214

214215
If control is transferred to the body of a catch block, and the last instruction
215216
in the body is executed, control then exits the try block.
@@ -263,12 +264,12 @@ end
263264
```
264265

265266
In this example, `N` is used to disambiguate which caught exception is being
266-
rethrown. It could rethrow any of the three caught expceptions. Hence,
267-
`rethrow 0` corresponds to the exception caught by `catch 3`, `rethrow 1`
268-
corresponds to the exception caught by `catch 2`, and `rethrow 3` corresponds
269-
to the exception caught by `catch 1`. In wat format, the argument for the
270-
`rethrow` instructions can also be written as a label, like branches. So
271-
`rethrow 0` in the example above can also be written as `rethrow $l3`.
267+
rethrown. It could rethrow any of the three caught expceptions. Hence, `rethrow
268+
0` corresponds to the exception caught by `catch 3`, `rethrow 1` corresponds to
269+
the exception caught by `catch 2`, and `rethrow 3` corresponds to the exception
270+
caught by `catch 1`. In wat format, the argument for the `rethrow` instructions
271+
can also be written as a label, like branches. So `rethrow 0` in the example
272+
above can also be written as `rethrow $l3`.
272273

273274
Note that `rethrow 2` is not allowed because it does not reference a catch
274275
block. Rather, it references a `block` instruction, so it will result in a
@@ -298,11 +299,11 @@ try blocktype
298299
delegate label
299300
```
300301

301-
The `delegate` clause does not have an associated body, so try-delegate
302-
blocks don't have an `end` instruction at the end. The `delegate` instruction
303-
takes a label defined by a construct in which they are enclosed, and delegates
304-
exception handling to a catch/unwind block specified by the label. For example,
305-
consider this code:
302+
The `delegate` clause does not have an associated body, so try-delegate blocks
303+
don't have an `end` instruction at the end. The `delegate` instruction takes a
304+
label defined by a construct in which they are enclosed, and delegates exception
305+
handling to a catch/unwind block specified by the label. For example, consider
306+
this code:
306307

307308
```
308309
try $l1
@@ -318,11 +319,9 @@ end
318319

319320
If `call $foo` throws, searching for a catching block first finds `delegate`,
320321
and because it delegates exception handling to catching instructions associated
321-
with `$l1`, it will be next checked by the outer `catch` and then
322-
`catch_all` instructions.
323-
When the specified label within a `delegate`
324-
instruction does not correspond to a `try` instruction, it is a validation
325-
failure.
322+
with `$l1`, it will be next checked by the outer `catch` and then `catch_all`
323+
instructions. When the specified label within a `delegate` instruction does not
324+
correspond to a `try` instruction, it is a validation failure.
326325

327326
Note that the example below is a validation failure:
328327
```

0 commit comments

Comments
 (0)