Skip to content

feat: add abortErrorGuard reusable#23

Open
Guria wants to merge 1 commit into
mainfrom
feat/abort-error-guard
Open

feat: add abortErrorGuard reusable#23
Guria wants to merge 1 commit into
mainfrom
feat/abort-error-guard

Conversation

@Guria

@Guria Guria commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Adds abortErrorGuard — a test-time collector for unexpected AbortErrors surfaced on .onReject lifecycle actions.

  • installAbortErrorGuard() registers a global extension once (idempotent) that hooks every *.onReject action and records payloads that are aborts (isAbort). Returns { clear, drain, format }; also exported as named clearAbortErrors / drainAbortErrors / formatAbortErrors.
  • drain() groups identical errors by action name + message with a count, then empties the buffer.
  • Intended for a Storybook/Vitest beforeEach teardown that fails a test when aborts leaked during it.
  • Extracted from a production app (guria/modern-stack .storybook/abortErrorGuard.ts); the app-specific regression assertion was dropped and documented as a recipe instead.

Docs note the caveat that addGlobalExtension cannot be uninstalled (process-wide, permanent); clear/drain reset only the buffer. Node tests cover collection, grouping/count, non-abort exclusion, drain/clear, and single-registration.

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 13, 2026 23:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Add an opt-in, idempotent collector for AbortErrors emitted by async action rejection handlers.
@Guria
Guria force-pushed the feat/abort-error-guard branch from d2c04fc to 88f071d Compare July 13, 2026 23:48
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.

2 participants