This repository was archived by the owner on Apr 25, 2025. It is now read-only.
File tree 1 file changed +18
-3
lines changed
proposals/exception-handling
1 file changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -238,9 +238,9 @@ Note that a caught exception can be rethrown using the `rethrow` instruction.
238
238
239
239
### Rethrowing an exception
240
240
241
- The ` rethrow ` instruction can only appear in the body of a catch/catch_all block
242
- but not within the body of an unwind block. It always re-throws the exception
243
- caught by an enclosing catch block.
241
+ The ` rethrow ` instruction can only appear in the body of a
242
+ catch/catch_all/ unwind block. It always re-throws the exception caught by an
243
+ enclosing catch block.
244
244
245
245
Associated with the ` rethrow ` instruction is a _ label_ . The label is used to
246
246
disambiguate which exception is to be rethrown, when inside nested catch blocks.
297
297
The ` rethrow ` here references ` try $l2 ` , but the ` rethrow ` is not within its
298
298
` catch ` block.
299
299
300
+ Also, the ` rethrow ` instruction cannot rethrow an exception caught
301
+ by an unwind block. For example:
302
+ ```
303
+ try $l1
304
+ unwind
305
+ try $l2
306
+ catch
307
+ try $l3
308
+ unwind
309
+ rethrow label ;; only $l2 is valid
310
+ end
311
+ end
312
+ end
313
+ ```
314
+
300
315
### Try-delegate blocks
301
316
302
317
Try blocks can also be used with the ` delegate ` instruction. A try-delegate
You can’t perform that action at this time.
0 commit comments