Skip to content

Commit

Permalink
Cannot rethrow exceptions caught by unwind blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
aheejin committed Feb 24, 2021
1 parent 275c449 commit 4d6c635
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions proposals/exception-handling/Exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ Note that a caught exception can be rethrown using the `rethrow` instruction.

### Rethrowing an exception

The `rethrow` instruction can only appear in the body of a catch/catch_all block
but not within the body of an unwind block. It always re-throws the exception
caught by an enclosing catch block.
The `rethrow` instruction can only appear in the body of a
catch/catch_all/unwind block. It always re-throws the exception caught by an
enclosing catch block.

Associated with the `rethrow` instruction is a _label_. The label is used to
disambiguate which exception is to be rethrown, when inside nested catch blocks.
Expand Down Expand Up @@ -297,6 +297,21 @@ end
The `rethrow` here references `try $l2`, but the `rethrow` is not within its
`catch` block.

Also, the `rethrow` instruction cannot rethrow an exception caught
by an unwind block. For example:
```
try $l1
unwind
try $l2
catch
try $l3
unwind
rethrow label ;; only $l2 is valid
end
end
end
```

### Try-delegate blocks

Try blocks can also be used with the `delegate` instruction. A try-delegate
Expand Down

0 comments on commit 4d6c635

Please sign in to comment.