public static Object location(SourceLocation location) { Map<String, Integer> map = new LinkedHashMap<>(); map.put("line", location.getLine()); map.put("column", location.getColumn()); return map; }
private String mkMessage(String msg, String offendingToken, SourceLocation location) { StringBuilder sb = new StringBuilder(); sb.append("Invalid Syntax :"); if (msg != null) { sb.append(" ").append(msg); } if (offendingToken != null) { sb.append(String.format(" offending token '%s'", offendingToken)); } if (location != null) { sb.append(String.format(" at line %d column %d", location.getLine(), location.getColumn())); } return sb.toString(); }
public static String lineCol(Node node) { SourceLocation sourceLocation = node.getSourceLocation() == null ? NO_WHERE : node.getSourceLocation(); return String.format("[@%d:%d]", sourceLocation.getLine(), sourceLocation.getColumn()); }
public static Object location(SourceLocation location) { Map<String, Integer> map = new LinkedHashMap<>(); map.put("line", location.getLine()); map.put("column", location.getColumn()); return map; }
private String mkMessage(String msg, String offendingToken, SourceLocation location) { StringBuilder sb = new StringBuilder(); sb.append("Invalid Syntax :"); if (msg != null) { sb.append(" ").append(msg); } if (offendingToken != null) { sb.append(String.format(" offending token '%s'", offendingToken)); } if (location != null) { sb.append(String.format(" at line %d column %d", location.getLine(), location.getColumn())); } return sb.toString(); }
public static String lineCol(Node node) { SourceLocation sourceLocation = node.getSourceLocation() == null ? NO_WHERE : node.getSourceLocation(); return String.format("[@%d:%d]", sourceLocation.getLine(), sourceLocation.getColumn()); }
public String getSourceLocation() { return source + ":[" + definition.getSourceLocation().getLine() + ", " + definition.getSourceLocation().getColumn() + "]"; }
/** * Creates a new {@link QueryError} data object * based on the provided {@link GraphQLError}. * * @param graphQLError the graphql error to convert * @return the converted query error data object */ public static QueryError convertToQueryError(GraphQLError graphQLError) { return new QueryError(graphQLError.getErrorType().name(), graphQLError.getMessage(), graphQLError.getLocations().stream().map(location -> new ErrorLocation(location.getLine(), location.getColumn())).collect(Collectors.toList())); } }
@Override public String getMessage() { String result = ""; for (GraphQLError error : errors) { result += error.getErrorType() + ": " + error.getMessage() + "\n"; for (SourceLocation sourceLocation : error.getLocations()) { result += " at line: " + sourceLocation.getLine() + " column: " + sourceLocation.getColumn(); } } return result; } }
JsonObject errorLocation = new JsonObject(); errorLocation.put("line", location.getLine()); errorLocation.put("column", location.getColumn()); errorLocations.add(errorLocation);
definition.getClass().getSimpleName() + " [" + definition.getSourceLocation().getLine() + "," + definition.getSourceLocation().getColumn() + "]");