In here, I can both graphQLErrors and networkError:
const errorLink = onError(({ operation, graphQLErrors, networkError, forward }) => {
if (process.env.NODE_ENV !== 'production') {
if (networkError) {
console.log(`[Network Error]:`, networkError.message);
}
if (graphQLErrors) {
graphQLErrors.forEach((error) => {
console.log(`[GraphQL Error]:`, error.message);
});
}
}
});
but when trying to get these errors inside useQuery, at the component level, only networkError is returned while graphQLErrors is an empty array:
let { loading, error, data } = useQuery(GET_ALL_PROJECTS, {
variables: { pageNum: 1, pageSize: 10 },
fetchPolicy: 'network-only',
});
For example, I get an error 403 to onError function from backend, but could not handle this error inside useQuery!