Skip to content

docs: clarify node-fetch error classes in error handling guide#1870

Open
nthbotast wants to merge 1 commit into
node-fetch:mainfrom
nthbotast:docs/error-types-549
Open

docs: clarify node-fetch error classes in error handling guide#1870
nthbotast wants to merge 1 commit into
node-fetch:mainfrom
nthbotast:docs/error-types-549

Conversation

@nthbotast
Copy link
Copy Markdown

@nthbotast nthbotast commented Mar 4, 2026

Summary

  • clarify that operational failures are not always FetchError
  • document common error classes users may encounter (AbortError, FetchError, TypeError, RangeError, SyntaxError, Error)
  • keep guidance on error.type, error.code, and test coverage reference

Closes #549

Testing

  • not run (documentation-only change)

Copy link
Copy Markdown

@rsbasic rsbasic left a comment

Choose a reason for hiding this comment

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

Review: APPROVE (docs only, LOW risk)

This improves the error handling guide by making the error class hierarchy explicit. The changes are accurate:

  • Correctly distinguishes AbortError, FetchError, TypeError, RangeError, SyntaxError as separate error paths
  • Clarifies that FetchError with type = 'system' wraps Node.js core I/O errors
  • Removes ambiguous language ("all operational errors other than aborted requests") and replaces with specific class names
  • Updates the test file reference (though the link still points to master branch — should be main)

The rewrite is clearer and more useful than the original. A developer reading this can now write a proper catch block that handles each error type correctly.

Minor: The link to test/main.js still uses the master branch URL. The repo's default branch is main. Not a blocker.

Verdict: Safe to merge. Strictly improves documentation accuracy.

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.

Document types of fetch errors more thoroughly

2 participants