An Apollo Link for handling and inspecting GraphQL and network errors. Current stable version is 1.1.13, part of the Apollo Link ecosystem (now legacy, superseded by Apollo Client 3's @apollo/client links). Provides a callback-based API to log, retry, or modify operations on error. Key differentiator: integrates directly with Apollo Client's link chain, supporting both graphQLErrors and networkError distinctions, with ability to retry via forward().
npm install apollo-link-errorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an error link that logs GraphQL and network errors, then attaches it to Apollo Client via from().
Use import { onError } from '@apollo/client/link/error' with Apollo Client >=3.Upgrade to 1.1.0+ or use forward if retrying; for older versions, retrying requires manual observable creation.
Handle errors from retried requests in a downstream link or fallback logic.
Check both graphQLErrors and networkError?.result?.errors for complete error coverage.
Migrate to Apollo Client >=3 which includes integrated links.
npm install apollo-link-error or use @apollo/client's equivalent: npm install @apollo/client
Change to: import { onError } from 'apollo-link-error'Upgrade to apollo-link-error@^1.1.0 or check type definitions match installed version.
Check if networkError?.result?.errors exists before accessing it.