Skip to content

Commit f264a51

Browse files
committed
Merge pull request graphql-java#54 from andimarek/if-curly
add curly braces to exception throwing ifs
2 parents e74f7f6 + 06194da commit f264a51

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/main/java/graphql/execution/ExecutionStrategy.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ protected ExecutionResult completeValue(ExecutionContext executionContext, Graph
5656
if (fieldType instanceof GraphQLNonNull) {
5757
GraphQLNonNull graphQLNonNull = (GraphQLNonNull) fieldType;
5858
ExecutionResult completed = completeValue(executionContext, graphQLNonNull.getWrappedType(), fields, result);
59-
if (completed == null) throw new GraphQLException("Cannot return null for non-nullable type: " + fields);
59+
if (completed == null) {
60+
throw new GraphQLException("Cannot return null for non-nullable type: " + fields);
61+
}
6062
return completed;
6163

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

9597
protected GraphQLObjectType resolveType(GraphQLInterfaceType graphQLInterfaceType, Object value) {
9698
GraphQLObjectType result = graphQLInterfaceType.getTypeResolver().getType(value);
97-
if (result == null) throw new GraphQLException("could not determine type");
99+
if (result == null) {
100+
throw new GraphQLException("could not determine type");
101+
}
98102
return result;
99103
}
100104

101105
protected GraphQLObjectType resolveType(GraphQLUnionType graphQLUnionType, Object value) {
102106
GraphQLObjectType result = graphQLUnionType.getTypeResolver().getType(value);
103-
if (result == null) throw new GraphQLException("could not determine type");
107+
if (result == null) {
108+
throw new GraphQLException("could not determine type");
109+
}
104110
return result;
105111
}
106112

@@ -136,7 +142,9 @@ protected GraphQLFieldDefinition getFieldDef(GraphQLSchema schema, GraphQLObject
136142
}
137143

138144
GraphQLFieldDefinition fieldDefinition = parentType.getFieldDefinition(field.getName());
139-
if (fieldDefinition == null) throw new GraphQLException("unknown field " + field.getName());
145+
if (fieldDefinition == null) {
146+
throw new GraphQLException("unknown field " + field.getName());
147+
}
140148
return fieldDefinition;
141149
}
142150

0 commit comments

Comments
 (0)