Netflix / dgs-framework

GraphQL for Java with Spring Boot made easy.
https://netflix.github.io/dgs
Apache License 2.0
3.06k stars 295 forks source link

Expose errorType in TypedGraphQLError #1867

Closed kilink closed 5 months ago

kilink commented 6 months ago

Update TypedGraphQLError to expose errorType / ErrorClassification. The class originally always returned null for errorType so that the classification wouldn't be put in extensions when toSpecification was called; however, we can simply override toSpecification to implement our custom behavior and allow the errorType getter to return the actual ErrorClassification.

Additionally, update TypedGraphQLError's builder to extend GraphQLError.Builder, and allow it to be tolerant of nulls in places where GraphQLError.Builder is (location, path, extensions).

Fixes #736.