Graphql errors
From wikinotes
Documentation
spec(2018): error format https://spec.graphql.org/June2018/#sec-Errors
Basics
There are two possible replies for a graphql request.
// success (a json object with the key 'data') {"data": {"name": "foo", "id": 1} // failure (a json list with the key 'errors') { "errors": [ { "message": "Name for character with ID 1002 could not be fetched.", // <--- graphql spec keys "locations": [ { "line": 6, "column": 7 } ], "path": [ "hero", "heroFriends", 1, "name" ], "extensions": { // <-- library/application specific keys "code": "CAN_NOT_FETCH_BY_ID", "timestamp": "Fri Feb 9 14:33:09 UTC 2018" } } ] }Note that the
extensions
key was introduced to the spec in 2018.