Detect Fetch network errors across Node.js, Bun, Deno, and browsers. v1.3.2 – stable, low release cadence. Unlike manual checks (e.g., error.message.includes('fetch')), it handles the non-standardized error differences across runtimes. Useful for conditional retry logic or fallback handling in fetch-based code. Written in TypeScript, ships type definitions. Requires Node >=16. Minimal, zero-dependency package.
npm install is-network-errorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to use isNetworkError to distinguish fetch network errors from other errors and implement fallback logic.
Use Node >=16 and ESM imports, or use dynamic import() in CJS.
Ensure you only pass errors from fetch() calls.
Update import to default import: `import isNetworkError from 'is-network-error'`
Add 'type': 'module' in your package.json or rename the file to .mjs, or use dynamic import(): `const { default: isNetworkError } = await import('is-network-error')`Use dynamic import() or switch to ESM in your project.
Use `import isNetworkError from 'is-network-error'` (default import) not `import { isNetworkError } from 'is-network-error'`.No dependency data recorded yet.