From 239b634d3624ed473a899d4d3d023cbf545830d9 Mon Sep 17 00:00:00 2001 From: Radoslav Stankov Date: Thu, 2 Jul 2015 23:32:55 +0300 Subject: [PATCH] Don't resolve when invalid --- src/graphql.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/graphql.js b/src/graphql.js index 6fce03bd75..d73cd3c067 100644 --- a/src/graphql.js +++ b/src/graphql.js @@ -39,14 +39,15 @@ export function graphql( var validationResult = validateDocument(schema, ast); if (!validationResult.isValid) { resolve({ errors: validationResult.errors }); + } else { + resolve(execute( + schema, + rootObject, + ast, + operationName, + variableValues + )); } - resolve(execute( - schema, - rootObject, - ast, - operationName, - variableValues - )); }).catch(error => { return { errors: [ formatError(error) ] }; });