Package graphql
Class GraphqlErrorException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- graphql.GraphQLException
-
- graphql.GraphqlErrorException
-
- All Implemented Interfaces:
GraphQLError
,java.io.Serializable
- Direct Known Subclasses:
CoercingParseLiteralException
,CoercingParseValueException
,CoercingSerializeException
@PublicApi public class GraphqlErrorException extends GraphQLException implements GraphQLError
A base class for graphql runtime exceptions that also implementGraphQLError
and can be used in a general sense direct or have specialisations made of it.This is aimed amongst other reasons at Kotlin consumers due to https://github.com/graphql-java/graphql-java/issues/1690 as well as being a way to share common code.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GraphqlErrorException.Builder
protected static class
GraphqlErrorException.BuilderBase<T extends GraphqlErrorException.BuilderBase<T,B>,B extends GraphqlErrorException>
A trait like base class that contains the properties that GraphqlErrorException handles and can be used by other classes to derive their own builders.
-
Constructor Summary
Constructors Modifier Constructor Description protected
GraphqlErrorException(GraphqlErrorException.BuilderBase<?,?> builder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ErrorClassification
getErrorType()
java.util.Map<java.lang.String,java.lang.Object>
getExtensions()
java.util.List<SourceLocation>
getLocations()
java.util.List<java.lang.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 https://spec.graphql.org/draft/#sec-Errors.Error-Result-Formatstatic GraphqlErrorException.Builder
newErrorException()
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface graphql.GraphQLError
getMessage, toSpecification
-
-
-
-
Constructor Detail
-
GraphqlErrorException
protected GraphqlErrorException(GraphqlErrorException.BuilderBase<?,?> builder)
-
-
Method Detail
-
getLocations
public java.util.List<SourceLocation> getLocations()
- Specified by:
getLocations
in interfaceGraphQLError
- Returns:
- the location(s) within the GraphQL document at which the error occurred. Each
SourceLocation
describes the beginning of an associated syntax element
-
getErrorType
public ErrorClassification getErrorType()
- Specified by:
getErrorType
in interfaceGraphQLError
- Returns:
- an object classifying this error
-
getPath
public java.util.List<java.lang.Object> getPath()
Description copied from interface:GraphQLError
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- Specified by:
getPath
in interfaceGraphQLError
- Returns:
- the path in list format
-
getExtensions
public java.util.Map<java.lang.String,java.lang.Object> getExtensions()
- Specified by:
getExtensions
in interfaceGraphQLError
- Returns:
- a map of error extensions or null if there are none
-
newErrorException
public static GraphqlErrorException.Builder newErrorException()
-
-