Skip to content

Make catch generic to improve call site ergonomics#701

Merged
peterstace merged 2 commits intomasterfrom
refactor_catch_fn
Feb 13, 2026
Merged

Make catch generic to improve call site ergonomics#701
peterstace merged 2 commits intomasterfrom
refactor_catch_fn

Conversation

@peterstace
Copy link
Owner

Description

Previously, callers that needed a result from catch had to declare a variable before the call and assign to it inside the closure via capture. By making catch a generic function returning (T, error), callers can now return values directly from the closure and use return catch(...) without the intermediate variable.

Check List

Have you:

  • Added unit tests? N/A

  • Add cmprefimpl tests? (if appropriate?) N/A

  • Updated release notes? (if appropriate?) N/A

  • Updated the README.md (if new functionality is added?) N/A

Related Issue

  • N/A

Previously, callers that needed a result from catch had to declare a
variable before the call and assign to it inside the closure via
capture. By making catch a generic function returning (T, error),
callers can now return values directly from the closure and use
`return catch(...)` without the intermediate variable.
@peterstace peterstace self-assigned this Feb 13, 2026
@peterstace peterstace merged commit 1e24be9 into master Feb 13, 2026
1 check passed
@peterstace peterstace deleted the refactor_catch_fn branch February 13, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant