Skip to content

feat(core,errors): AstroidTimeoutError error hierarchy and normalizeTimeoutMs - #347

Merged
Cjay-Cyber-2 merged 1 commit into
mainfrom
fix/pr-341-request-timeout
Sep 29, 2026
Merged

Cjay-Cyber-2 merged 1 commit into
mainfrom
fix/pr-341-request-timeout

Conversation

@Cjay-Cyber-2

Copy link
Copy Markdown
Contributor

Applies the core infrastructure changes from #341 (per-request abort/timeout), extracting the parts that don't conflict with already-merged PRs.

Changes

  • packages/errors/src/classes.ts: Add AstroidTimeoutError extends NetworkError with timeoutMs field and dual-form constructor
  • packages/errors/src/guards.ts: Add isTimeoutError guard
  • packages/errors/src/index.ts: Export AstroidTimeoutError, isTimeoutError; map REQUEST_TIMEOUT code in errorClassForCode
  • packages/types/src/common.ts: Add REQUEST_TIMEOUT to ApiErrorCode
  • packages/core/src/config.ts: Add normalizeTimeoutMs utility; use it in resolveConfig
  • packages/core/src/http-client.ts: Use normalizeTimeoutMs for per-request timeout
  • packages/core/src/index.ts: Export normalizeTimeoutMs
  • packages/core/src/timeout-error.ts: Re-export AstroidTimeoutError from @astroid/errors for backwards compatibility
  • packages/client/src/__tests__/timeout-error-hierarchy.test.ts (new): Test suite for error hierarchy

🤖 Generated with Claude Code

https://claude.ai/code/session_01AXsLpxHFDNQw6bP5pnmE8L


Generated by Claude Code

… (fix for #341)

- Move AstroidTimeoutError to @astroid/errors as a NetworkError subclass
  with timeoutMs field and compatible dual-form constructor
- Add isTimeoutError guard to @astroid/errors
- Export AstroidTimeoutError and isTimeoutError from @astroid/errors
- Add REQUEST_TIMEOUT code to ApiErrorCode in @astroid/types
- Map REQUEST_TIMEOUT code to AstroidTimeoutError in errorClassForCode
- Add normalizeTimeoutMs utility to @astroid/core/config
- Use normalizeTimeoutMs in resolveConfig and per-request timeout path
- Export normalizeTimeoutMs from @astroid/core
- Re-export AstroidTimeoutError from @astroid/core/timeout-error for backwards compat
- Add timeout-error-hierarchy.test.ts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AXsLpxHFDNQw6bP5pnmE8L
@Cjay-Cyber-2
Cjay-Cyber-2 merged commit 80da5e7 into main Sep 29, 2026
1 check passed
Cjay-Cyber-2 added a commit that referenced this pull request Sep 30, 2026
…e docs (#359)

`src/AstroidError.ts` is the compatibility re-export module for the layout
documented in #279, but it was not updated when `AstroidTimeoutError` landed in
#347. `import { AstroidTimeoutError } from './AstroidError.js'` therefore
resolved to `undefined` for consumers using that import path.

- Re-export `AstroidTimeoutError` from `AstroidError.ts`, matching `index.ts`.
- Add `public-surface.test.ts`, which pins the compatibility module to the
  entrypoint by identity (not just presence, so `instanceof` cannot silently
  diverge) and asserts every symbol documented in the README is really
  exported. Verified to fail without the one-line fix.
- Refresh the stale README class list and document the mapping helpers,
  guards, Stellar mapping and stack-safety options that were missing.

Verified: pnpm build, pnpm typecheck, pnpm test (all packages), pnpm lint.
@astroid/errors goes from 197 to 247 tests passing.

Co-authored-by: Bushra <bushragbadegesin@gmail.com>
Co-authored-by: Chijioke Joseph <chijiokejoseph2022@gmail.com>
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