[
https://issues.apache.org/jira/browse/SLING-10422?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17352545#comment-17352545
]
Bertrand Delacretaz commented on SLING-10422:
---------------------------------------------
I forgot that we are already populating the {{extensions}} field, see the
[DefaultQueryExecutorTest|https://github.com/apache/sling-org-apache-sling-graphql-core/blob/a5e684fb476f9c43d44f337a84507a4bebd33ec1/src/test/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutorTest.java#L136]
for example.
What might be useful is a way for the {{SlingDataFetcher}} and similar
components to be able to add information to those {{extensions}} - while being
careful to avoid disclosing sensitive information there. Currently the
{{SlingGraphQLErrorHelper}} puts a limited stack trace here.
> 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
> Priority: Minor
>
> 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)