B - this base class allows you to derive new classes from this base error builder@PublicApi public class GraphqlErrorBuilder<B extends GraphqlErrorBuilder<B>> extends java.lang.Object
GraphQLErrors and also has a quick way to make a DataFetcherResults
from that error.| Modifier | Constructor and Description |
|---|---|
protected |
GraphqlErrorBuilder() |
| Modifier and Type | Method and Description |
|---|---|
GraphQLError |
build() |
B |
errorType(ErrorClassification errorType) |
B |
extensions(java.util.Map<java.lang.String,java.lang.Object> extensions) |
ErrorClassification |
getErrorType() |
java.util.Map<java.lang.String,java.lang.Object> |
getExtensions() |
java.util.List<SourceLocation> |
getLocations() |
java.lang.String |
getMessage() |
java.util.List<java.lang.Object> |
getPath() |
B |
location(SourceLocation location) |
B |
locations(java.util.List<SourceLocation> locations) |
B |
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. |
B |
path(java.util.List<java.lang.Object> path) |
B |
path(ResultPath path) |
DataFetcherResult<?> |
toResult()
A helper method that allows you to return this error as a
DataFetcherResult |
public java.lang.String getMessage()
@Nullable public java.util.List<java.lang.Object> getPath()
@Nullable public java.util.List<SourceLocation> getLocations()
public ErrorClassification getErrorType()
@Nullable public java.util.Map<java.lang.String,java.lang.Object> getExtensions()
public static GraphqlErrorBuilder<?> newError()
GraphQLErrorspublic static GraphqlErrorBuilder<?> newError(DataFetchingEnvironment dataFetchingEnvironment)
GraphQLError.getLocations() and GraphQLError.getPath() for you from the
fetching environment.dataFetchingEnvironment - the data fetching environmentGraphQLErrorspublic B message(java.lang.String message, java.lang.Object... formatArgs)
public B locations(@Nullable java.util.List<SourceLocation> locations)
public B location(@Nullable SourceLocation location)
public B path(@Nullable ResultPath path)
public B path(@Nullable java.util.List<java.lang.Object> path)
public B errorType(ErrorClassification errorType)
public B extensions(@Nullable java.util.Map<java.lang.String,java.lang.Object> extensions)
public GraphQLError build()
public DataFetcherResult<?> toResult()
DataFetcherResult