From 06194da8747bde1522a9c686fb1204d3cb5619c1 Mon Sep 17 00:00:00 2001 From: Stephan Behnke Date: Wed, 9 Dec 2015 15:36:29 +0100 Subject: [PATCH] add curly braces to exception throwing ifs it's difficult to debug the exception when you can't set a breakpoint to the point where the exception is actually thrown --- .../graphql/execution/ExecutionStrategy.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/graphql/execution/ExecutionStrategy.java b/src/main/java/graphql/execution/ExecutionStrategy.java index 72096225b2..3f169a52ff 100644 --- a/src/main/java/graphql/execution/ExecutionStrategy.java +++ b/src/main/java/graphql/execution/ExecutionStrategy.java @@ -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) { @@ -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; } @@ -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; }