Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

graphQLErrors returns an empty array for mutations onError #1285

Open
cmnstmntmn opened this issue Jun 13, 2020 · 0 comments
Open

graphQLErrors returns an empty array for mutations onError #1285

cmnstmntmn opened this issue Jun 13, 2020 · 0 comments

Comments

@cmnstmntmn
Copy link

i'm having this link

const errorLink = onError(
  ({ graphQLErrors, networkError, operation, forward }) => {
    if (graphQLErrors) {
      for (let err of graphQLErrors) {
        let { message, locations, path } = err;

        console.log(
          `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`
        );

        switch (message) {
          case "Not Authorized":
            notAuthHandler();
            break;
          default:
            console.info(message);
        }
      }
    }
    if (networkError) {
      console.log(`[Network error]: ${networkError}`);
    }

    return forward(operation);
  }
);

in here, i can both graphQLErrors and networkError, but when trying to get these errors after a mutation, at the component level, only networkError is returned while graphQLErrors is an empty array.

@cmnstmntmn cmnstmntmn changed the title graphQLErrors returns an empty array for mutationsonError graphQLErrors returns an empty array for mutations onError Jun 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant