Reilly Wood
ed1f0eb231
Make catch block a closure w/ access to error ( #7228 )
...
A small follow-up to #7221 . This changes the `catch` block from a block
to a closure, so that it can access the error returned from the `try`
block. This helps with a common scenario: "the `try` block failed, and I
want to log why it failed."
### Example

### Future Work
Nu's closure syntax is a little awkward here; it might be nicer to allow
something like `catch err { print $err }`. We discussed this on Discord
and it will require special parser code similar to what's already done
for `for`.
I'm not feeling confident enough in my parser knowledge to make that
change; I will spend some more time looking at the `for` code but I
doubt I will be able to implement anything in the next few days.
Volunteers welcome.
2022-11-25 07:02:20 +13:00
..
2022-11-10 11:16:14 +13:00
2022-06-26 00:35:23 +03:00
2022-10-20 23:28:18 +13:00
2022-11-23 16:55:13 +13:00
2022-08-11 11:54:54 -05:00
2022-08-10 08:43:56 -05:00
2022-08-18 11:58:51 -05:00
2022-11-22 16:58:11 -08:00
2022-02-16 07:38:02 -05:00
2022-09-11 11:48:27 +03:00
2022-09-30 07:14:02 -05:00
2022-11-13 15:15:27 -08:00
2022-11-19 10:14:29 -08:00
2022-10-14 21:51:44 +02:00
2022-11-21 14:35:11 +01:00
2022-11-21 14:35:11 +01:00
2022-02-21 08:38:15 -05:00
2022-02-07 14:54:06 -05:00
2022-11-05 07:38:39 +13:00
2022-02-07 14:54:06 -05:00
2022-08-12 21:13:50 -05:00
2022-09-01 08:32:56 +12:00
2022-02-07 14:54:06 -05:00
2022-11-24 16:58:15 +13:00
2022-09-05 16:41:06 +02:00
2022-11-21 17:04:36 +01:00
2022-02-17 06:40:24 -05:00
2022-11-01 11:36:54 -07:00
2022-02-07 14:54:06 -05:00
2022-07-12 06:03:50 -05:00
2022-02-16 07:38:02 -05:00
2022-08-02 10:26:16 -05:00
2022-02-09 05:58:54 -05:00
2022-11-23 17:04:28 +13:00
2022-09-11 11:48:27 +03:00
2022-10-29 16:29:46 -05:00
2022-08-06 10:11:03 -05:00
2022-10-29 19:47:50 +02:00
2022-10-15 18:00:38 +02:00
2022-02-16 12:24:45 -06:00
2022-11-09 16:43:24 -08:00
2022-11-20 07:22:42 -06:00
2022-05-18 20:47:26 -05:00
2022-11-21 14:35:11 +01:00
2022-11-10 22:33:15 +01:00
2022-07-04 06:31:50 +12:00
2022-11-23 17:04:04 +13:00
2022-02-07 14:54:06 -05:00
2022-11-11 19:51:08 +13:00
2022-09-28 17:08:17 -05:00
2022-11-04 15:11:17 -05:00
2022-11-23 17:01:27 +13:00
2022-02-07 14:54:06 -05:00
2022-11-24 17:52:11 +13:00
2022-11-12 07:50:43 +13:00
2022-08-07 13:30:40 -05:00
2022-11-24 16:58:15 +13:00
2022-11-22 16:58:11 -08:00
2022-08-07 13:30:40 -05:00
2022-08-04 14:51:02 -05:00
2022-02-09 05:58:54 -05:00
2022-07-02 09:54:49 -05:00
2022-02-09 05:58:54 -05:00
2022-11-24 16:58:15 +13:00
2022-11-21 14:35:11 +01:00
2022-11-20 07:22:42 -06:00
2022-05-13 06:47:11 -05:00
2022-09-28 17:08:17 -05:00
2022-08-04 06:59:20 -05:00
2022-09-11 11:48:27 +03:00
2022-09-11 11:48:27 +03:00
2022-09-28 17:07:50 -05:00
2022-11-20 19:32:15 -06:00
2022-11-10 10:57:44 +13:00
2022-02-07 14:54:06 -05:00
2022-11-09 17:06:47 -08:00
2022-08-08 06:31:24 -05:00
2022-11-10 11:16:51 +13:00
2022-11-10 11:16:51 +13:00
2022-10-15 08:28:54 -05:00
2022-02-07 14:54:06 -05:00
2022-02-19 19:26:47 -05:00
2022-02-07 14:54:06 -05:00
2022-11-16 08:03:56 -06:00
2022-09-28 13:48:34 +13:00
2022-06-22 19:19:06 -05:00
2022-11-25 07:02:20 +13:00
2022-11-23 15:46:20 -08:00
2022-11-21 14:35:11 +01:00
2022-11-21 14:35:11 +01:00
2022-10-22 11:41:31 -05:00
2022-11-22 16:58:11 -08:00
2022-03-24 16:42:41 +13:00
2022-11-12 07:21:45 +13:00
2022-02-22 11:32:29 -05:00
2022-02-09 05:58:54 -05:00
2022-09-11 11:48:27 +03:00