Skip to content

adds :wrap_handler() and :finally() - #53

Merged
lePereT merged 1 commit into
nextfrom
next_wrap_handler
Nov 9, 2025
Merged

adds :wrap_handler() and :finally()#53
lePereT merged 1 commit into
nextfrom
next_wrap_handler

Conversation

@lePereT

@lePereT lePereT commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • 🍕 Feature
  • ✅ Test

Description

Extends the core event system in fibers.op with CML-style exception handling and cleanup combinators.

  • Adds Event:wrap_handler(handler) for post-synchronisation exception recovery.
  • Adds Event:finally(cleanup) for guaranteed cleanup on both success and failure paths.
  • Updates compile_event to carry handler chains and apply them in innermost-first order.
  • Refactors bracket to use finally for unified resource cleanup.
  • Introduces corresponding tests in tests/test_op.lua covering nested wrap_handler, builder errors, and finally semantics.

Related Issues, Tickets & Documents

N/A

Screenshots/Recordings

N/A

Manual test

  • 👍 yes

Manual test description

Executed tests/test_op.lua; all new and existing cases pass, confirming correct behaviour of wrap_handler nesting and finally cleanup logic.

Added tests?

  • 👍 yes

Added to documentation?

  • 🙅 no documentation needed

[optional] Are there any post-deployment tasks we need to perform?

None.

@lePereT
lePereT changed the base branch from main to next November 9, 2025 13:44
@lePereT
lePereT merged commit 70c12d4 into next Nov 9, 2025
1 check passed
@lePereT
lePereT deleted the next_wrap_handler branch November 9, 2025 14:06
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