As mentioned in the response section, every GraphQL response consists of 3 parts: errors, extensions and data.
Therefore, it is natural to assume that error handling is of great importance.
The error entry in the response is a JSON formated list of errors, where each error is a map.
If one or more errors are present, data in the response body will be null.
Error format is standardized so that it is easy for developers to understand and correct the error and also to be able to easily pipeline it to other resource because of the structure always being the same.
Every error contains an entry with 4 key-value pairs describing in more details the error that occured. Those keys can be best seen in the example bellow:
{
"message": "String"
"locations": { "line" : Integer, "Column" : Integer },
"errorType": "String",
"errorSubType": "String"
}
Errors can also be logged via external SaaS solution with powerful Loggly platform. More info available in Loggly page