Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/main/java/graphql/execution/ExecutionStrategy.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ protected ExecutionResult completeValue(ExecutionContext executionContext, Graph
if (fieldType instanceof GraphQLNonNull) {
GraphQLNonNull graphQLNonNull = (GraphQLNonNull) fieldType;
ExecutionResult completed = completeValue(executionContext, graphQLNonNull.getWrappedType(), fields, result);
if (completed == null) throw new GraphQLException("Cannot return null for non-nullable type: " + fields);
if (completed == null) {
throw new GraphQLException("Cannot return null for non-nullable type: " + fields);
}
return completed;

} else if (result == null) {
Expand Down Expand Up @@ -94,13 +96,17 @@ protected ExecutionResult completeValue(ExecutionContext executionContext, Graph

protected GraphQLObjectType resolveType(GraphQLInterfaceType graphQLInterfaceType, Object value) {
GraphQLObjectType result = graphQLInterfaceType.getTypeResolver().getType(value);
if (result == null) throw new GraphQLException("could not determine type");
if (result == null) {
throw new GraphQLException("could not determine type");
}
return result;
}

protected GraphQLObjectType resolveType(GraphQLUnionType graphQLUnionType, Object value) {
GraphQLObjectType result = graphQLUnionType.getTypeResolver().getType(value);
if (result == null) throw new GraphQLException("could not determine type");
if (result == null) {
throw new GraphQLException("could not determine type");
}
return result;
}

Expand Down Expand Up @@ -136,7 +142,9 @@ protected GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLObject
}

GraphQLFieldDefinition fieldDefinition = parentType.getFieldDefinition(field.getName());
if (fieldDefinition == null) throw new GraphQLException("unknown field " + field.getName());
if (fieldDefinition == null) {
throw new GraphQLException("unknown field " + field.getName());
}
return fieldDefinition;
}

Expand Down