Skip to content

Output errors which follows the specification #171

@drupalspring

Description

@drupalspring

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())); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions