Skip to content

errorPolicy: error is still thrown, for 200 status, even with 'all' or 'ignore' #1336

@robyte-ctrl

Description

@robyte-ctrl

Screenshot

Image

Description

Version is 6.1.0.

Also tried 7.1.2 but that one would always throw an internal error and then return null. Here's an image of the internal error:

Image


I want to handle the errors property from the response without having to wrap everything in a try-catch and detecting whether the error is from graphql-request or not (to see if I can convert it back into an object with the errors property and stop the error propagation). Sadly, setting errorPolicy to either 'ignore' or 'all' does not seem to prevent the error from being thrown.

Am I misunderstanding the use case for errorPolicy?

Also what is the rawRequest method which is referenced in the docs for errorPolicy: 'all' but not described anywhere? I did try it but it did not seem to change anything

Reproduction Steps/Repo Link

  1. create an instance of GraphQLClient with either errorPolicy: 'ignore' or errorPolicy: 'all' (I also have have the Authorization header set via the headers option)
  2. make a request that would return a 200 status with the errors property in the response body

Expected: the response is returned and it contains the expected errors property

Actual: an error is thrown, like in the first image from above, which has a property named response which is an object with the expected errors property

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions