I'm trying to catch all my graphQLErrors with the onError method from apollo client. My goal is to have only one catch block for all of my API calls.
const errorLink = onError(({ graphQLErrors, networkError ,operation}) => {
if (graphQLErrors && graphQLErrors?.length > 0) {
catchError((e) => handleError(e))
} else if (networkError) {
console.log(`[Network error]: ${networkError}`)
}
})
The current behavior is: If I do not catch each error inside the component that made the API call the default error page appears with the error
The desired behavior: The default error page will never appear (the error will be handled inside onError method)