/** * This method will only put one error per field path. * * @param error the error to add * @param fieldPath the field path to put it under */ public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; } } } this.errors.add(error); }
/** * This method will only put one error per field path. * * @param error the error to add * @param fieldPath the field path to put it under */ public void addError(GraphQLError error, ExecutionPath fieldPath) { // // see http://facebook.github.io/graphql/#sec-Errors-and-Non-Nullability about how per // field errors should be handled - ie only once per field if its already there for nullability // but unclear if its not that error path // for (GraphQLError graphQLError : errors) { List<Object> path = graphQLError.getPath(); if (path != null) { if (fieldPath.equals(ExecutionPath.fromList(path))) { return; } } } this.errors.add(error); }