redux-toolkit icon indicating copy to clipboard operation
redux-toolkit copied to clipboard

GraphQL error message issue

Open faizanali1192 opened this issue 3 years ago • 1 comments

What i am using: I am using GraphQL api's and Code generator (which automatically generates queries and mutations).

Error return from the backend in Network:    
          `{"errors":[{"message":"Invalid data","locations":[{"line":2,"column":3}],"path":["testError"]}],"data":null}`

What rtk-query gives error in error message: Invalid data: {"response":{"errors":[{"message":"Invalid data","locations":[{"line":2,"column":3}],"path":["testError"]}],"data":null,"status":500,"headers":{"map":{"content-length":"108","content-type":"application/json; charset=utf-8"}}},"request":{"query":"\n query ExampleQuery {\n testError\n}\n "}}

What i actually needs:
           "Invalid data"

faizanali1192 avatar Jun 23 '22 14:06 faizanali1192

I had the same issue as you mentioned above and I resolved it by customErrors https://stackoverflow.com/questions/71828943/how-to-handle-error-format-in-redux-toolkit-rtk-query-graphql-application

ASahak avatar Aug 24 '22 20:08 ASahak