Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Only call GraphqlErrorBuilder with non-null data #568

Conversation

jeskew-gov
Copy link

The methods on GraphqlErrorBuilder each contain an assertion that the supplied data is non-null, but it is not required that these elements be non-null on every throw GraphQLError. For example, errors often omit a path property, which will lead to an unhandled graphql.AssertException when the error is handled by GraphQLErrorFromExceptionHandler.java.

At present, type coercion errors always result in a HTTP response with an empty body and a 400 response code due to the way graphql-java normalizes CoercingParseValueExceptions

The methods on GraphqlErrorBuilder each contain [an assertion that the supplied data is non-null](https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/GraphqlErrorBuilder.java#L77), but it is not required that these elements be non-null on every throw GraphQLError. For example, errors often omit a `path` property, which will lead to an unhandled `graphql.AssertException` when the error is handled by `GraphQLErrorFromExceptionHandler.java`.
@jeskew-gov jeskew-gov force-pushed the allow-errors-with-null-paths branch from 2bf3698 to 6d73ea0 Compare March 31, 2021 18:06
@jeskew-gov jeskew-gov force-pushed the allow-errors-with-null-paths branch from 6d73ea0 to 140d935 Compare March 31, 2021 18:15
@oliemansm oliemansm added this to the 11.1.0 milestone Apr 26, 2021
@oliemansm oliemansm merged commit e9b96f9 into graphql-java-kickstart:master Apr 26, 2021
@oliemansm
Copy link
Member

Thanks for your contribution, @jeskew-gov !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants