Skip to content

Output errors which follows the specification #171

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
drupalspring opened this issue Apr 26, 2019 · 0 comments
Closed

Output errors which follows the specification #171

drupalspring opened this issue Apr 26, 2019 · 0 comments
Milestone

Comments

@drupalspring
Copy link

drupalspring commented Apr 26, 2019

Current GraphQLObjectMapper outputs JSON response using the following codes in convertSanitizedExecutionResult() .:

        if (areErrorsPresent(executionResult)) {
            result.put("errors", executionResult.getErrors());
        }

It causes that if GraphQLError is ExceptionWhileDataFetching and if it contains a Throwable internally , all of that Stacktrace will be dump out in the response. Is it a good idea to always ensure that GraphQLError is serialised to JSON according to the specification by using the method GraphQLError#toSpecification() such that I don't need to customize GraphQLObjectMapper or GraphQLErrorHandler ?

   if (areErrorsPresent(executionResult)) {
            result.put("errors", executionResult.getErrors().stream().map(err->err.toSpecification()).collect(toList()));
   }
@oliemansm oliemansm added this to the 7.5.1 milestone Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants