@PublicApi public class GraphqlErrorBuilder extends java.lang.Object
GraphQLError
s and also has a quick way to make a DataFetcherResult
s
from that error.Modifier and Type | Method and Description |
---|---|
GraphQLError |
build() |
GraphqlErrorBuilder |
errorType(ErrorClassification errorType) |
GraphqlErrorBuilder |
extensions(java.util.Map<java.lang.String,java.lang.Object> extensions) |
GraphqlErrorBuilder |
location(SourceLocation location) |
GraphqlErrorBuilder |
locations(java.util.List<SourceLocation> locations) |
GraphqlErrorBuilder |
message(java.lang.String message,
java.lang.Object... formatArgs) |
static GraphqlErrorBuilder |
newError() |
static GraphqlErrorBuilder |
newError(DataFetchingEnvironment dataFetchingEnvironment)
This will set up the
GraphQLError.getLocations() and GraphQLError.getPath() for you from the
fetching environment. |
GraphqlErrorBuilder |
path(java.util.List<java.lang.Object> path) |
GraphqlErrorBuilder |
path(ResultPath path) |
DataFetcherResult |
toResult()
A helper method that allows you to return this error as a
DataFetcherResult |
public static GraphqlErrorBuilder newError()
GraphQLError
spublic static GraphqlErrorBuilder newError(DataFetchingEnvironment dataFetchingEnvironment)
GraphQLError.getLocations()
and GraphQLError.getPath()
for you from the
fetching environment.dataFetchingEnvironment
- the data fetching environmentGraphQLError
spublic GraphqlErrorBuilder message(java.lang.String message, java.lang.Object... formatArgs)
public GraphqlErrorBuilder locations(java.util.List<SourceLocation> locations)
public GraphqlErrorBuilder location(SourceLocation location)
public GraphqlErrorBuilder path(ResultPath path)
public GraphqlErrorBuilder path(java.util.List<java.lang.Object> path)
public GraphqlErrorBuilder errorType(ErrorClassification errorType)
public GraphqlErrorBuilder extensions(java.util.Map<java.lang.String,java.lang.Object> extensions)
public GraphQLError build()
public DataFetcherResult toResult()
DataFetcherResult