Errors
The error information in the response will depend on the type of error that was raised.
Our implementation follows the GraphQL specification Response | GraphQL
The GraphQL specification allows three top-level keys in a response:
data,errors, andextensions.At least one of
dataorerrorswill be present on the response (when it contains both it is a “partial response”).The
datakey contains the result of the executed operation.Information about raised errors is included in the
errorskey of the responseRequest errors (such as syntax or validation errors) are raised before execution begins so
datawon’t be included in the response.When a field error occurs during execution, there will be a description of the issue in the
errorskey and there may be partial data included with thedatakey.
Error via status code
As with network calls to any type of API, network errors that are not specific to GraphQL may happen at any point during a request.
For example, 5xx error code for server error or 4xx for bad request.
{
"exceptionName": "PsoRequestValidationException",
"httpStatus": "BAD_REQUEST",
"message": "Error occurred: Bad Request. Details: Invalid GraphQL query",
"timestamp": 1733753727180
}Error in the json response
According to the GraphQL specification, request error or field error are listed in the JSON response.
It means that a 200 status code is not necessary a success.
To be sure that the query is completly succesfull, the json response has to be check to see if the “errors” array contains errors messages.
For example
The HTTP status code is 200 and the response is:
{
"data": null,
"errors": [
"Error occurred, details: Failed to reach GraphQL API"
]
}Last updated

