Skip to content

feat(core): export FetchError as a named export from @readme/api-core#1180

Merged
erunion merged 1 commit into
readmeio:mainfrom
zain-asif-dev:feat/export-fetcherror-from-core
Jul 6, 2026
Merged

feat(core): export FetchError as a named export from @readme/api-core#1180
erunion merged 1 commit into
readmeio:mainfrom
zain-asif-dev:feat/export-fetcherror-from-core

Conversation

@zain-asif-dev

Copy link
Copy Markdown
Contributor

Description

FetchError is thrown directly by APICore#fetch for error-level status codes, but it could only be imported via the @readme/api-core/errors/fetchError subpath. There was no way to import it alongside the main APICore import from the package root, making it harder for consumers to discover how to do instanceof checks against it.

This adds a named export for FetchError from the package root (packages/core/src/index.ts), so it can now be imported as:

import APICore, { FetchError } from '@readme/api-core';

in addition to the existing subpath import.

Fixes #967

Testing

Added a test asserting that the named export from the package root is the exact same class as the one imported from the errors/fetchError subpath. Ran the full @readme/api-core test suite (83 passing) and tsc --noEmit, both clean.

FetchError could only be imported via the @readme/api-core/errors/fetchError
subpath even though it's thrown directly by APICore#fetch, so consumers
had no discoverable way to import it for instanceof checks alongside
the main APICore import.

Signed-off-by: Zain Asif <zainasif.jutt1@gmail.com>
@zain-asif-dev zain-asif-dev requested a review from erunion as a code owner July 6, 2026 18:12
@changeset-bot

changeset-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c492666

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@readme/api-core Minor
api Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@erunion erunion changed the title Export FetchError as a named export from @readme/api-core feat(core): export FetchError as a named export from @readme/api-core Jul 6, 2026
@erunion erunion merged commit d89c23d into readmeio:main Jul 6, 2026
8 of 9 checks passed
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.

Export FetchError from API Core

2 participants