Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix FetchError.errno type to match Node.js SystemError#1860

Open
veeceey wants to merge 1 commit intonode-fetch:mainfrom
veeceey:fix/issue-1831-errno-type
Open

Fix FetchError.errno type to match Node.js SystemError#1860
veeceey wants to merge 1 commit intonode-fetch:mainfrom
veeceey:fix/issue-1831-errno-type

Conversation

@veeceey
Copy link

@veeceey veeceey commented Feb 13, 2026

This fixes the TypeScript type definition for FetchError.errno to properly match Node.js SystemError spec, where errno is a number rather than a string.

Changes

  1. TypeScript definitions (@types/index.d.ts):

    • Changed errno?: string to errno?: number
    • Added erroredSysCall?: string property (was missing but set in implementation)
  2. Implementation (src/errors/fetch-error.js):

    • Fixed to assign errno from systemError.errno (number) instead of incorrectly using systemError.code (string)
  3. Tests (test/main.js):

    • Updated custom FetchError test to properly set errno as a number
    • Removed errno assertion from network failure test (platform-specific numeric value)

Testing

Ran full test suite - all existing tests pass (3 failures are pre-existing flaky network tests unrelated to this change).

Fixes #1831

Changes:
- Updated TypeScript definition: errno?: string -> errno?: number
- Added erroredSysCall property to match implementation
- Fixed implementation to assign errno from systemError.errno instead of systemError.code
- Updated tests to reflect correct errno type

Fixes node-fetch#1831
@veeceey
Copy link
Author

veeceey commented Feb 19, 2026

Friendly ping - any chance someone could take a look at this when they get a chance? Happy to make any changes if needed.

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.

Why is FetchError.errno a string and not a number?

1 participant