Open
Description
Recently, GraphQL Response Specification got updated with a suggestion to place custom data in error in the extensions
object. The spec can be found here https://github.com/facebook/graphql/blob/master/spec/Section%207%20--%20Response.md
An excerpt of the relevant section:
GraphQL services may provide an additional entry to errors with key
extensions
. This entry, if set, must have a map as its value. This entry is reserved for implementors to add additional information to errors however they see fit, and there are no additional restrictions on its contents.
{
"errors": [
{
"message": "Name for character with ID 1002 could not be fetched.",
"locations": [ { "line": 6, "column": 7 } ],
"path": [ "hero", "heroFriends", 1, "name" ],
"extensions": {
"code": "CAN_NOT_FETCH_BY_ID",
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
}
}
]
}