Package graphql

Interface GraphQLError

All Superinterfaces:
Serializable
All Known Implementing Classes:
AbortExecutionException, CoercingParseLiteralException, CoercingParseValueException, CoercingSerializeException, DirectiveIllegalArgumentTypeError, DirectiveIllegalLocationError, DirectiveIllegalReferenceError, DirectiveMissingNonNullArgumentError, DirectiveRedefinitionError, DirectiveUndeclaredError, DirectiveUnknownArgumentError, ExceptionWhileDataFetching, GoodFaithIntrospection.BadFaithIntrospectionError, GraphqlErrorException, IllegalNameError, InputMapDefinesTooManyFieldsException, InterfaceFieldArgumentNotOptionalError, InterfaceFieldArgumentRedefinitionError, InterfaceFieldRedefinitionError, InterfaceImplementedMoreThanOnceError, InterfaceImplementingItselfError, InterfaceWithCircularImplementationHierarchyError, IntrospectionDisabledError, InvalidCursorException, InvalidPageSizeException, InvalidSyntaxError, MissingInterfaceFieldArgumentsError, MissingInterfaceFieldError, MissingInterfaceTypeError, MissingRootTypeException, MissingScalarImplementationError, MissingTransitiveInterfaceError, MissingTypeError, MissingTypeResolverError, NonNullableFieldWasNullError, NonNullableValueCoercedAsNullException, NonSDLDefinitionError, NonUniqueArgumentError, NonUniqueDirectiveError, NonUniqueNameError, NotAnInputTypeError, NotAnOutputTypeError, OneOfNullValueException, OneOfTooManyKeysException, OperationRedefinitionError, OperationTypesMustBeObjects, QueryOperationMissingError, SchemaMissingError, SchemaRedefinitionError, SerializationError, TypeExtensionDirectiveRedefinitionError, TypeExtensionEnumValueRedefinitionError, TypeExtensionFieldRedefinitionError, TypeExtensionMissingBaseTypeError, TypeMismatchError, TypeRedefinitionError, UnionTypeError, UnknownOperationException, UnresolvedTypeError, ValidationError

@PublicApi public interface GraphQLError extends Serializable
The interface describing graphql errors NOTE: This class implements Serializable and hence it can be serialised and placed into a distributed cache. However we are not aiming to provide long term compatibility and do not intend for you to place this serialised data into permanent storage, with times frames that cross graphql-java versions. While we don't change things unnecessarily, we may inadvertently break the serialised compatibility across versions.
See Also:
  • Method Details

    • getMessage

      String getMessage()
      Returns:
      a description of the error intended for the developer as a guide to understand and correct the error
    • getLocations

      List<SourceLocation> getLocations()
      Returns:
      the location(s) within the GraphQL document at which the error occurred. Each SourceLocation describes the beginning of an associated syntax element
    • getErrorType

      ErrorClassification getErrorType()
      Returns:
      an object classifying this error
    • getPath

      default List<Object> getPath()
      The graphql spec says that the (optional) path field of any error must be a list of path entries starting at the root of the response and ending with the field associated with the error http://spec.graphql.org/draft/#sec-Errors.Error-Result-Format
      Returns:
      the path in list format
    • toSpecification

      default Map<String,Object> toSpecification()
      The graphql specification says that result of a call should be a map that follows certain rules on what items should be present. Certain JSON serializers may or may interpret the error to spec, so this method is provided to produce a map that strictly follows the specification. See : GraphQL Spec - 7.1.2 Errors
      Returns:
      a map of the error that strictly follows the specification
    • getExtensions

      default Map<String,Object> getExtensions()
      Returns:
      a map of error extensions or null if there are none
    • fromSpecification

      static GraphQLError fromSpecification(Map<String,Object> specificationMap)
      This can be called to turn a specification error map into GraphQLError
      Parameters:
      specificationMap - the map of values that should have come via toSpecification()
      Returns:
      a GraphQLError
    • newError

      static GraphQLError.Builder<?> newError()
      Returns:
      a new builder of GraphQLErrors