Add extensions field to error response #171
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change 1: Added extensions to the error response.
Change 2: Added debug option to GraphQL Configuration (flag to output exception information to extensions)
Change 3: Moved serialize (), which was defined as an extension of GraphQLError, into GraphQLError. option
Change 1: Added extensions to the error response.
fields in extensions.
ex1:
output
ex2:
output
Change 2: Added debug option to GraphQL Configuration (flag to output exception information to extensions)
First, set the debug option to true when installing GraphQL
Then raise GraphQLError
Finaly, the debug field is automatically added to extensions, and the detailed information of exception is output.
Change 3: Moved serialize (), which was defined as an extension function of GraphQLError, into GraphQLError. option
I want to move serialize () to use GraphQLError outside the KGraphQL plugin.
For example, KGraphQL relies on an external plugin for authentication processing.
In that case, if an authentication error occurs, 401 will occur and you will not be able to return a response in the general GraphQL error format.
Therefore, I would like to do the following.
In the StatusPages plugin, I want to create a GraphQLError and use the serialize () to make it json and respond.
For that, serialize () wants to go inside GraphQLError.