public final class GraphQLError
- Object
- GraphQLError
One entry from a GraphQL response errors array. A GraphQL server
may return errors alongside partial data, so an error here does
not necessarily mean the whole request failed – inspect
GraphQLResponse.getData() as well.
The spec-defined keys are surfaced directly: message (always
present), path (the response field path the error applies to),
locations (line/column positions in the request document), and
the open-ended extensions object. Unknown keys are ignored.
Constructors
public GraphQLError(String message, List<Object> path, List<Map<String, Object>> locations, Map<String, Object> extensions) |
Methods
public String getMessage() | The human-readable error description. |
public List<Object> getPath() | The response path the error applies to (string field names and integer list indices), or null when the server did not supply one. |
public List<Map<String, Object>> getLocations() | Source {line, column} locations in the request document, or null when absent. |
public Map<String, Object> getExtensions() | The open-ended extensions object (often carries an error code), or null when absent. |
public String toString() | Returns a string representation of the object. |
Inherited methods
Constructor details
GraphQLError
public GraphQLError(String message, List<Object> path, List<Map<String, Object>> locations, Map<String, Object> extensions)Method details
getMessage
public String getMessage()The human-readable error description. Never null in a
spec-compliant response, but defaults to an empty string when
the server omits it.
getPath
public List<Object> getPath()The response path the error applies to (string field names and
integer list indices), or null when the server did not supply
one.
getLocations
public List<Map<String, Object>> getLocations()Source
{line, column} locations in the request document, or
null when absent.getExtensions
public Map<String, Object> getExtensions()The open-ended
extensions object (often carries an error
code), or null when absent.toString
public String toString()Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.
The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
getClass().getName() + ‘@’ + Integer.toHexString(hashCode())