Apollo-link: Apollo-link-retry: Doesn’t support retry on GQL errors only network errors

Created on 9 Mar 2018  ·  1Comment  ·  Source: apollographql/apollo-link

I’d like to see the retry link allow for retries on graphQL errors, not just network ones. Sometimes there are transient 5xx style errors in a GQL resolver.

Most helpful comment

@RylanH The below link "promotes" graphql errors to real errors and retry link will process them. You must put this link between your http link and your retry link.

      new ApolloLink((operation, forward) => {
        return forward(operation).map((data) => {
          if (data && data.errors && data.errors.length > 0) {
            throw new Error('GraphQL Operational Error');
          }
          return data;
        });
      }),

>All comments

@RylanH The below link "promotes" graphql errors to real errors and retry link will process them. You must put this link between your http link and your retry link.

      new ApolloLink((operation, forward) => {
        return forward(operation).map((data) => {
          if (data && data.errors && data.errors.length > 0) {
            throw new Error('GraphQL Operational Error');
          }
          return data;
        });
      }),
Was this page helpful?
0 / 5 - 0 ratings