title: apollo-link-error description: Handle and inspect errors in your GraphQL network stack.
Use this link to do some custom logic when a GraphQL or network error happens:
;const link =;
Apollo Link is a system of modular components for GraphQL networking. Read the docs to learn how to use this link with libraries like Apollo Client and graphql-tools, or as a standalone client.
Error Link takes a function that is called in the event of an error. This function is called with an object containing the following keys:
operation: The Operation that errored
response: The result returned from lower down in the link chain
graphQLErrors: An array of errors from the GraphQL endpoint
networkError: Any error during the link execution or server response, that wasn't delivered as part of the
errorsfield in the GraphQL result
An error is passed as a
networkError if a link further down the chain called the
error callback on the observable. In most cases,
graphQLErrors is the
errors field of the result from the last
networkError can contain additional fields, such as a GraphQL object in the case of a failing HTTP status code from
apollo-link-http. In this situation,
graphQLErrors is an alias for
networkError.result.errors if the property exists.
If you want to conditionally ignore errors, you can set
response.errors = null; within the error handler: