Exceptions thrown during execution of an operation will result in an empty data response and a GraphQLError that is added to a list of errors of the result. See graphql-java documentation for more details on how to customize your exception handling.
GraphQL allows you to return both data and errors in a single response, as long as the data returned still matches the schema. Depending on the criticality of the encountered error, instead of throwing an exception, you may want to return
default data or use a nullable field, but still include more information in the
errors block. In Kotlin, functions return only a single value, which means that in order to return both data
and errors you have to explicitly return them wrapped in a
An example of a query returning partial data is available in our spring example app.