Class GraphQLError

java.lang.Object
com.codename1.io.graphql.GraphQLError

public final class GraphQLError extends java.lang.Object

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.

  • Constructor Summary

    Constructors
    Constructor
    Description
    GraphQLError(String message, List<java.lang.Object> path, List<Map<String, java.lang.Object>> locations, Map<String, java.lang.Object> extensions)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<String, java.lang.Object>
    The open-ended extensions object (often carries an error code), or null when absent.
    List<Map<String, java.lang.Object>>
    Source {line, column} locations in the request document, or null when absent.
    The human-readable error description.
    List<java.lang.Object>
    The response path the error applies to (string field names and integer list indices), or null when the server did not supply one.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GraphQLError

      public GraphQLError(String message, List<java.lang.Object> path, List<Map<String, java.lang.Object>> locations, Map<String, java.lang.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<java.lang.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, java.lang.Object>> getLocations()
      Source {line, column} locations in the request document, or null when absent.
    • getExtensions

      public Map<String, java.lang.Object> getExtensions()
      The open-ended extensions object (often carries an error code), or null when absent.
    • toString

      public String toString()
      Overrides:
      toString in class java.lang.Object