Interface ResponseError


public interface ResponseError
Represents a GraphQL response error.
Since:
1.0
Author:
Rossen Stoyanchev
  • Method Summary

    Modifier and Type
    Method
    Description
    Return a classification for the error that is specific to GraphQL Java.
    Return a map with GraphQL Java and other implementation specific protocol error detail extensions such as getErrorType(), possibly empty.
    Return a list of locations in the GraphQL document, if the error can be associated to a particular point in the document.
    Return the message with a description of the error intended for the developer as a guide to understand and correct the error.
    Return the path to a response field which experienced the error, if the error can be associated to a particular field in the result, or otherwise an empty list.
    Return a String representation of the parsed path, or an empty String if the error is not associated with a field.
  • Method Details

    • getMessage

      @Nullable String getMessage()
      Return the message with a description of the error intended for the developer as a guide to understand and correct the error.
    • getErrorType

      ErrorClassification getErrorType()
      Return a classification for the error that is specific to GraphQL Java. This is serialized under "extensions" in the response map.
      See Also:
    • getPath

      String getPath()
      Return a String representation of the parsed path, or an empty String if the error is not associated with a field.

      Example paths:

       "hero"
       "hero.name"
       "hero.friends"
       "hero.friends[2]"
       "hero.friends[2].name"
       
    • getParsedPath

      List<Object> getParsedPath()
      Return the path to a response field which experienced the error, if the error can be associated to a particular field in the result, or otherwise an empty list. This allows a client to identify whether a null result is intentional or caused by an error.

      This list contains path segments starting at the root of the response and ending with the field associated with the error. Path segments that represent fields are strings, and path segments that represent list indices are 0-indexed integers. If the error happens in an aliased field, the path uses the aliased name, since it represents a path in the response, not in the request.

    • getLocations

      List<SourceLocation> getLocations()
      Return a list of locations in the GraphQL document, if the error can be associated to a particular point in the document. Each location has a line and a column, both positive, starting from 1 and describing the beginning of an associated syntax element.
    • getExtensions

      Map<String,Object> getExtensions()
      Return a map with GraphQL Java and other implementation specific protocol error detail extensions such as getErrorType(), possibly empty.