Does anyone know if there's a clean way to intercept and alter the error reporting of NonNullableFieldWasNullException in graphql-java, it seems to automagically and always add a non-null error when you use exceptions to handle error conditions in data fetchers.
s
Saharath Kleips
03/01/2021, 6:08 PM
I believe you might be able to look into implementing
DataFetcherExceptionHandler
? We use the Spring module so ours is exposed as a bean.
d
Dariusz Kuc
03/02/2021, 3:19 AM
I am unsure whether you can disable the exception - it is thrown by
graphql-java
result validation
Returning null for non-null fields is a violation of a GraphQL spec and a critical error that will blow up whole query execution up to its root.
d
Daniel Skogquist Åborg
03/04/2021, 12:30 PM
The problem is that the non-null validation kicks in even when I attempt to abort execution of the query using AbortExecutionException - to perform authentication only on certain parts of the query graph.
The result is that I get my query aborted with the correct error, but graphql-java also automatically adds errors for the non-null validation since it interprets the query failing as trying to assign a null value (when nothing should be returned).
I'd like to get rid of the irrelevant non-null validation errors when I abort the execution of a query.
Anyone know how to do this?