GraphQL - Error Handling
Integrations GraphQL Training GraphQL Error Handling

GraphQL - Error Handling

Error Handling in GraphQL

With GraphQL you should check the HTTP Status Codes in return of the HTTP POST request (and it should return status code 200 OK - Success!). When you receive a HTTP status code different from 200 then you have probably one of the following issues:

But that’s not all. Once the GraphQL web service has accepted the GraphQL query, an error message can be returned in the response.
That’s what happened in the exercise where you added the Manager field without specifying a Selection Set for Manager:
Query the manager of the me object with a wrong Selection Set

When the response contains results.data the GraphQL is ok, but when the response contains results.errors the GraphQL query failed to execute. In that case the variables or context provided in the GraphQL query is probably bad. You need to add error handling code to your integrations that acts on the HTTP Status Codes and on the results.errors responses.

Next Topic