feat(automation): structured try/catch/retry block (ADR-0031, task 4)#1499
Merged
Conversation
Add engine execution for the `try_catch` construct — the structured error model (ADR-0031 §Decision 3), completing the native control-flow trio (loop / parallel / try-catch). - new builtin/try-catch-node.ts: runs the protected `try` region via engine.runRegion; on failure retries with exponential backoff (config.retry), then runs the optional `catch` region with the caught error bound to config.errorVariable (default `$error`). try success (incl. a retry) → node succeeds; catch handling a failure → node succeeds; no catch / failing catch → node fails to the flow's fault edge / error handling. - registered as a built-in node executor. - well-formedness (single-entry/single-exit try/catch regions) already enforced at registerFlow() by validateControlFlow (shipped with the loop container). - showcase ResilientSyncFlow + 8 executor tests; changeset added. https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
os-zhuang
added a commit
that referenced
this pull request
Jun 2, 2026
The structured control-flow constructs (loop/parallel/try-catch) and the BPMN interop mapping are implemented and merged (#1482, #1489, #1499, #1500; docs #1497). Flip ADR-0031 from Proposed to Accepted and record the implementing PRs and the deferred follow-ups (#1504 BPMN XML plugin, #1505 region step logs). https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements ADR-0031 task 4 (issue #1479) — engine execution for the structured
try_catchconstruct, completing the native control-flow execution trio (loop #1482 / parallel #1489 / try-catch). Builds on the schemas +runRegion+ region validation already onmain.What's in this PR
@objectstack/service-automation—builtin/try-catch-node.ts(new)tryregion viarunRegionin the enclosing variable scope.tryregion with exponential backoff (config.retry:maxRetries,retryDelayMs,backoffMultiplier,maxRetryDelayMs,jitter).catchregion with the caught error bound toconfig.errorVariable(default$error).try(or a retry) succeeds → node succeeds;catchhandles the failure → node succeeds; nocatch, orcatchitself fails → node fails, surfacing to the flow's fault edge / error handling.fault+ backoff-retry semantics as a construct (not BPMN boundary events). Registered as a built-in executor.Well-formedness (single-entry/single-exit
try/catchregions) is already enforced atregisterFlow()byvalidateControlFlowfrom the loop PR.Showcase / changeset
ResilientSyncFlow— pushes a task to an external system, retrying on failure and recording the error viacatch.Tests
builtin/try-catch-node.test.ts— 8 tests: try-succeeds (catch not run), catch-on-failure (+error binding), retry-then-succeed, retry-exhausted→catch, no-catch→node fails, catch-itself-fails, malformed-try rejected at register, multi-node try ordering.Roadmap (#1479)
https://claude.ai/code/session_012ti8cx3TkdiQdjCnZXZg2Q
Generated by Claude Code