Search in sources :

Example 1 with SerializationError

use of graphql.SerializationError in project graphql-java by graphql-java.

the class ExecutionResultJSONTesting method createER.

private ExecutionResult createER() {
    List<GraphQLError> errors = new ArrayList<>();
    errors.add(new ValidationError(ValidationErrorType.UnknownType, mkLocations(), "Test ValidationError"));
    errors.add(new MissingRootTypeException("Mutations are not supported.", null));
    errors.add(new InvalidSyntaxError(mkLocations(), "Not good syntax m'kay"));
    errors.add(new NonNullableFieldWasNullError(new NonNullableFieldWasNullException(mkTypeInfo(), mkPath())));
    errors.add(new SerializationError(mkPath(), new CoercingSerializeException("Bad coercing")));
    errors.add(new ExceptionWhileDataFetching(mkPath(), new RuntimeException("Bang"), mkLocation(666, 999)));
    return new ExecutionResultImpl(null, errors);
}
Also used : NonNullableFieldWasNullException(graphql.execution.NonNullableFieldWasNullException) MissingRootTypeException(graphql.execution.MissingRootTypeException) NonNullableFieldWasNullError(graphql.execution.NonNullableFieldWasNullError) ArrayList(java.util.ArrayList) SerializationError(graphql.SerializationError) InvalidSyntaxError(graphql.InvalidSyntaxError) ExecutionResultImpl(graphql.ExecutionResultImpl) GraphQLError(graphql.GraphQLError) ExceptionWhileDataFetching(graphql.ExceptionWhileDataFetching) ValidationError(graphql.validation.ValidationError) CoercingSerializeException(graphql.schema.CoercingSerializeException)

Example 2 with SerializationError

use of graphql.SerializationError in project graphql-java by graphql-java.

the class ExecutionStrategy method handleCoercionProblem.

@SuppressWarnings("SameReturnValue")
private Object handleCoercionProblem(ExecutionContext context, ExecutionStrategyParameters parameters, CoercingSerializeException e) {
    SerializationError error = new SerializationError(parameters.getPath(), e);
    log.warn(error.getMessage(), e);
    context.addError(error);
    parameters.deferredErrorSupport().onError(error);
    return null;
}
Also used : SerializationError(graphql.SerializationError)

Aggregations

SerializationError (graphql.SerializationError)2 ExceptionWhileDataFetching (graphql.ExceptionWhileDataFetching)1 ExecutionResultImpl (graphql.ExecutionResultImpl)1 GraphQLError (graphql.GraphQLError)1 InvalidSyntaxError (graphql.InvalidSyntaxError)1 MissingRootTypeException (graphql.execution.MissingRootTypeException)1 NonNullableFieldWasNullError (graphql.execution.NonNullableFieldWasNullError)1 NonNullableFieldWasNullException (graphql.execution.NonNullableFieldWasNullException)1 CoercingSerializeException (graphql.schema.CoercingSerializeException)1 ValidationError (graphql.validation.ValidationError)1 ArrayList (java.util.ArrayList)1