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
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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
GraphQLError.Builder<B extends GraphQLError.Builder<B>>
A builder ofGraphQLError
s -
Method Summary
Modifier and TypeMethodDescriptionstatic GraphQLError
fromSpecification
(Map<String, Object> specificationMap) This can be called to turn a specification error map intoGraphQLError
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 https://spec.graphql.org/draft/#sec-Errors.Error-Result-Formatstatic GraphQLError.Builder
<?> newError()
The graphql specification says that result of a call should be a map that follows certain rules on what items should be present.
-
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
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 https://spec.graphql.org/draft/#sec-Errors.Error-Result-Format- Returns:
- the path in list format
-
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
- Returns:
- a map of error extensions or null if there are none
-
fromSpecification
This can be called to turn a specification error map intoGraphQLError
- Parameters:
specificationMap
- the map of values that should have come viatoSpecification()
- Returns:
- a
GraphQLError
-
newError
- Returns:
- a new builder of
GraphQLError
s
-