Bertrand Delacretaz created SLING-10422:
-------------------------------------------

             Summary: Improve error reporting in GraphQL output
                 Key: SLING-10422
                 URL: https://issues.apache.org/jira/browse/SLING-10422
             Project: Sling
          Issue Type: Improvement
          Components: GraphQL
    Affects Versions: GraphQL Core 0.0.10
            Reporter: Bertrand Delacretaz


The error reporting features of the GraphQL Core can be improved, as in this 
example (from [http://spec.graphql.org/June2018/#example-08b62)] where an 
{{extensions}} key is used to provide details on specific errors:

{code}
{
  "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"
      }
    }
  ]
}
{code}

We might for example create an interface for Exceptions that provide 
information for such {{extensions}}, maybe a Map that can be used to add 
free-form information there. And probably define some standard key names and 
formats inside the {{extensions}} for machine consumption.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to