2121import com .fasterxml .jackson .databind .ObjectMapper ;
2222import com .fasterxml .jackson .databind .RuntimeJsonMappingException ;
2323import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
24+ import graphql .ExceptionWhileDataFetching ;
2425import graphql .ExecutionResult ;
2526import graphql .GraphQL ;
2627import graphql .GraphQLError ;
@@ -306,6 +307,12 @@ private Map<String, Object> createResultFromDataAndErrors(Object data, List<Grap
306307 if (clientErrors .size () < errors .size ()) {
307308 // Some errors were filtered out to hide implementation - put a generic error in place.
308309 clientErrors .add (new GenericGraphQLError ("Internal Server Error(s) while executing query" ));
310+
311+ errors .stream ()
312+ .filter (error -> !isClientError (error ))
313+ .forEach (error -> {
314+ log .error ("Error executing query ({}): {}" , error .getClass ().getSimpleName (), error .getMessage ());
315+ });
309316 }
310317 result .put ("errors" , clientErrors );
311318 }
@@ -318,9 +325,13 @@ private boolean errorsPresent(List<GraphQLError> errors) {
318325 }
319326
320327 protected List <GraphQLError > filterGraphQLErrors (List <GraphQLError > errors ) {
321- return errors .stream ().
322- filter (error -> error instanceof InvalidSyntaxError || error instanceof ValidationError ).
323- collect (Collectors .toList ());
328+ return errors .stream ()
329+ .filter (this ::isClientError )
330+ .collect (Collectors .toList ());
331+ }
332+
333+ protected boolean isClientError (GraphQLError error ) {
334+ return error instanceof InvalidSyntaxError || error instanceof ValidationError ;
324335 }
325336
326337 private <T > void runListeners (List <T > listeners , Consumer <? super T > action ) {
0 commit comments