Errors
When an error is returned it follows the standard
GraphQL approach
of a 200
response containing an errors
array.
Error Extensions
Because a query is often composed of one or many upstream services and
resolvers the responses are enhanced with an extentions
object. This object contains
information to help you locate where and why an error happened, and provides the
detail required to respond to errors in your application.
Error Examples
Upstream 404
{
"errors": [
{
"message": "Response code 404 (Not Found)",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"getCharacter"
],
"extensions": {
"code": "RESOLVER_ERROR",
"originalError": {
"name": "HTTPError",
"message": "Response code 404 (Not Found)",
"statusCode": 404,
"statusMessage": "Not Found",
"data": {
"error": "Character not found"
},
"headers": {
"access-control-allow-origin": "*",
"age": "1",
"content-length": "31",
"content-type": "application/json; charset=utf-8",
"date": "Wed, 22 Mar 2023 21:56:10 GMT",
"etag": "W/\"1f-t9l5xVmJZaPHJIukjZQ7Mw4gpG8\"",
"server": "Netlify",
"strict-transport-security": "max-age=31536000",
"x-nf-request-id": "01GW5N510ZRSYMVJVXM6HCSXN6",
"x-powered-by": "Express",
"connection": "close"
},
"requestUrl": "https://rickandmortyapi.com/api/character/900"
},
"service": "rick",
"id": "RICK",
"step": "1",
"resolver": "rest:get"
}
}
]
}
```json title="GraphQL Error"
{
"errors": [
{
"message": "Invalid global id '122'",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"Shopify_customerPaymentMethodCreditCardUpdate"
],
"extensions": {
"code": "RESOLVER_ERROR",
"originalError": {
"message": "Invalid global id '122'",
"path": [
"customerPaymentMethodCreditCardUpdate",
"customerPaymentMethodCreditCardUpdate",
"id"
],
"extensions": {
"code": "argumentLiteralsIncompatible",
"typeName": "CoercionError"
},
"name": "GraphQLError"
},
"service": "shopify",
"step": "1",
"resolver": "graphql:mutation"
}
}
],
}