Interface GraphQLError


public interface GraphQLError

Contains an error message, the location of the code that caused the error, and other information to help you correct the error.


Example to create an instance using the builder pattern

     GraphQLError graphQLError = GraphQLError.builder()
             .message("{message}")
             .plusLocations(locationsBuilder -> locationsBuilder)
             .extensions(extensionsBuilder -> extensionsBuilder)
             .build()
 
  • Method Details

    • getMessage

      @NotNull @NotNull String getMessage()

      Detailed description of the error explaining the root cause of the problem and suggesting how to correct the error.

      Returns:
      message
    • getLocations

      @NotNull @Valid @NotNull @Valid List<GraphQLErrorLocation> getLocations()

      Location within your query where the error occurred.

      Returns:
      locations
    • getPath

      List<Object> getPath()

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Returns:
      path
    • getExtensions

      @NotNull @Valid @NotNull @Valid GraphQLErrorObject getExtensions()

      Dictionary with additional information where applicable.

      Returns:
      extensions
    • setMessage

      void setMessage(String message)

      Detailed description of the error explaining the root cause of the problem and suggesting how to correct the error.

      Parameters:
      message - value to be set
    • setLocations

      void setLocations(GraphQLErrorLocation... locations)

      Location within your query where the error occurred.

      Parameters:
      locations - values to be set
    • setLocations

      void setLocations(List<GraphQLErrorLocation> locations)

      Location within your query where the error occurred.

      Parameters:
      locations - values to be set
    • setPath

      void setPath(Object... path)

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Parameters:
      path - values to be set
    • setPath

      void setPath(List<Object> path)

      Query fields listed in order from the root of the query response up to the field in which the error occurred. path is displayed in the response only if an error is associated with a particular field in the query result.

      Parameters:
      path - values to be set
    • setExtensions

      void setExtensions(GraphQLErrorObject extensions)

      Dictionary with additional information where applicable.

      Parameters:
      extensions - value to be set
    • of

      static GraphQLError of()
      factory method
      Returns:
      instance of GraphQLError
    • of

      static GraphQLError of(GraphQLError template)
      factory method to create a shallow copy GraphQLError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • deepCopy

      @Nullable static GraphQLError deepCopy(@Nullable GraphQLError template)
      factory method to create a deep copy of GraphQLError
      Parameters:
      template - instance to be copied
      Returns:
      copy instance
    • builder

      static GraphQLErrorBuilder builder()
      builder factory method for GraphQLError
      Returns:
      builder
    • builder

      static GraphQLErrorBuilder builder(GraphQLError template)
      create builder for GraphQLError instance
      Parameters:
      template - instance with prefilled values for the builder
      Returns:
      builder
    • withGraphQLError

      default <T> T withGraphQLError(Function<GraphQLError,T> helper)
      accessor map function
      Type Parameters:
      T - mapped type
      Parameters:
      helper - function to map the object
      Returns:
      mapped value
    • typeReference

      static com.fasterxml.jackson.core.type.TypeReference<GraphQLError> typeReference()
      gives a TypeReference for usage with Jackson DataBind
      Returns:
      TypeReference