@PublicApi public class GraphqlErrorBuilder extends 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(Map<String,Object> extensions) |
GraphqlErrorBuilder |
location(SourceLocation location) |
GraphqlErrorBuilder |
locations(List<SourceLocation> locations) |
GraphqlErrorBuilder |
message(String message,
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(ExecutionPath path) |
GraphqlErrorBuilder |
path(List<Object> 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(String message, Object... formatArgs)
public GraphqlErrorBuilder locations(List<SourceLocation> locations)
public GraphqlErrorBuilder location(SourceLocation location)
public GraphqlErrorBuilder path(ExecutionPath path)
public GraphqlErrorBuilder path(List<Object> path)
public GraphqlErrorBuilder errorType(ErrorClassification errorType)
public GraphqlErrorBuilder extensions(Map<String,Object> extensions)
public GraphQLError build()
public DataFetcherResult toResult()
DataFetcherResult
Copyright © 2019. All rights reserved.