Does anyone know if there's a clean way to interce...
# graphql-kotlin
d
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
I believe you might be able to look into implementing
DataFetcherExceptionHandler
? We use the Spring module so ours is exposed as a bean.
d
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
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?
d
You could try asking on graphql java spectrum