Class GraphQLException


public class GraphQLException extends RuntimeException

An error a resolver throws to put a message of its own in the response's errors, as Spring for GraphQL's GraphQLError does.

Any other exception thrown by a resolver is reported as INTERNAL_ERROR with no detail, so an exception message never leaks server internals to a client. Throw this one for messages that are meant to be read.

The field that threw resolves to null, and the rest of the response is still answered: GraphQL reports partial results.

  • Constructor Details

    • GraphQLException

      public GraphQLException(String message)
      An error with this message for the client.
    • GraphQLException

      public GraphQLException(String message, Map extensions)
      An error with this message and extensions, written as the error's extensions object -- classification or code by convention.
  • Method Details

    • getLine

      public int getLine()
      The line in the document the error refers to, or 0.
    • getColumn

      public int getColumn()
      The column in the document the error refers to, or 0.
    • getExtensions

      public Map getExtensions()
      The error's extensions, or null.