SIGN IN SIGN UP

refactor: unify AbortError detection with isAbortError utility (#10551)

* refactor: unify AbortError detection with isAbortError utility

AbortError detection was scattered across 3+ patterns (string
comparison, .name check, .code check). Consolidates into a single
isAbortError() utility that handles all known patterns: "cancel"
string, DOMException, Error.name variants, ABORT_ERR code, and
plain objects. Updates call sites in core/llm/index.ts and
core/llm/utils/retry.ts.

* fix: use exact match for AbortError name, add null guard, improve tests

- Changed .includes("AbortError") to === "AbortError" to preserve
  original exact-match semantics at L505 and retry.ts call sites
- Added null/undefined early return to prevent TypeError on
  "name" in null
- Unified DOMException branch to use exact match consistently
- Tests: removed 4 redundant same-branch duplicates, added 12 new
  cases (case sensitivity, empty string, non-string name, partial
  name boundary, DOMException negative, plain object code asymmetry,
  boolean, frozen object, Error subclass, TypeError)
- Fixed DOMException test skip from expect(true).toBe(true) to
  it.skipIf

* fix: replace == null with === null || === undefined (eqeqeq)

---------

Co-authored-by: amabito <192487536+amabito@users.noreply.github.com>
Co-authored-by: amabito <amabito@local>
K
Keita A. committed
af4383f6df877ef12ba9678adec5d27b0d8e9eb3
Parent: 97b203d
Committed by GitHub <noreply@github.com> on 3/13/2026, 11:10:05 PM