A specialized error class for the Fetch API, wrapping HTTP error responses with status code, status text, and optional response object. Version 1.0.0 stable, maintained on a semantic versioning cadence. Unlike generic Error, it allows instanceof checks and carries structured error info. Designed to pair with fetch() for clean error handling.
npm install fetch-errorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a FetchError from an HTTP response and catching it with instanceof to distinguish from network errors.
It extends Error, so instanceof Error works, but custom error properties (statusCode, statusText) are not standard.
Be aware that modifying the response object later will affect the error.
No known deprecations; but library ecosystem around Fetch API errors is limited.
Use `import FetchError from 'fetch-error'` (not `{ FetchError }`).Require it: `const FetchError = require('fetch-error')` or default import.No dependency data recorded yet.