This page covers working with GraphQL, where:
If there is a server-side error, there are two responses GraphQL can use: a 200 OK error, and a 500 server error. 200 OK errors provide partial data, while 500 errors do not.
An example of a 500 error:
{
"errors": [
{
"message": "This is the error message."
}
]
}
An example of a 200 OK error:
{
"errors": [
{
"message": "This is the error message.",
"locations": [
{
"line": 3,
"column": 5
}
],
"path": [
"whereTheErrorOccurred"
]
}
],
"data": {
"partialDataReturned": []
}
}
Note how the information is more complex in a 200 OK error. Since the type of error I had was simple and I didn't want to return any partial data to the user, the 500 error made more sense in this case.