Skip to content

OnError is an ErrorOption, shared by Restart and Retry - #101

Merged
pior merged 1 commit into
mainfrom
pior/v1.2/shared-on-error
Oct 6, 2026
Merged

pior merged 1 commit into
mainfrom
pior/v1.2/shared-on-error

Conversation

@pior

@pior pior commented Oct 6, 2026 •

Copy link
Copy Markdown
Owner

OnError moves into the shared error policy and returns an ErrorOption, like ErrorLimit. Restart now takes it too.

  • Restart calls it with each error, including the last one returned at the error limit, the same as Retry.
  • Source compatible: ErrorOption embeds RetryOption, so existing Retry(r, OnError(fn)) calls still compile. Only code that names the old func(func(error)) RetryOption type breaks.
  • This makes OnError a shared name on purpose, which satisfies the AGENTS.md naming rule.

@pior
pior added this pull request to stack #104 October 6, 2026 19:41
@pior
pior merged commit a06ce88 into main Oct 6, 2026
2 checks passed
@pior
pior deleted the pior/v1.2/shared-on-error branch October 6, 2026 21:00
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