From fda2afdc21aeea4c9b9f0fe43fe4fb8f555ad415 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Thu, 25 May 2017 22:14:42 -0700 Subject: [PATCH] Follow up to #883 --- src/execution/__tests__/executor-test.js | 4 ++-- src/execution/execute.js | 19 +------------------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/execution/__tests__/executor-test.js b/src/execution/__tests__/executor-test.js index 08929e1d8a..f539868e18 100644 --- a/src/execution/__tests__/executor-test.js +++ b/src/execution/__tests__/executor-test.js @@ -637,7 +637,7 @@ describe('Execute: Handles basic execution tasks', () => { }); }); - it('throws if no op name is provided with multiple operations', async () => { + it('errors if no op name is provided with multiple operations', async () => { const doc = 'query Example { a } query OtherExample { a }'; const data = { a: 'b' }; const ast = parse(doc); @@ -663,7 +663,7 @@ describe('Execute: Handles basic execution tasks', () => { }); }); - it('throws if unknown operation name is provided', async () => { + it('errors if unknown operation name is provided', async () => { const doc = 'query Example { a } query OtherExample { a }'; const ast = parse(doc); const schema = new GraphQLSchema({ diff --git a/src/execution/execute.js b/src/execution/execute.js index 78a170de28..1512ee31dd 100644 --- a/src/execution/execute.js +++ b/src/execution/execute.js @@ -154,8 +154,7 @@ export function execute( /* eslint-enable no-param-reassign, no-redeclare */ } - // If a valid context cannot be created due to incorrect arguments, - // this will throw an error. + // If arguments are missing or incorrect, throw an error. assertValidExecutionArguments( schema, document, @@ -259,22 +258,6 @@ export function buildExecutionContext( operationName: ?string, fieldResolver: ?GraphQLFieldResolver ): ExecutionContext { - invariant(schema, 'Must provide schema'); - invariant(document, 'Must provide document'); - invariant( - schema instanceof GraphQLSchema, - 'Schema must be an instance of GraphQLSchema. Also ensure that there are ' + - 'not multiple versions of GraphQL installed in your node_modules directory.' - ); - - // Variables, if provided, must be an object. - invariant( - !rawVariableValues || typeof rawVariableValues === 'object', - 'Variables must be provided as an Object where each property is a ' + - 'variable value. Perhaps look to see if an unparsed JSON string ' + - 'was provided.' - ); - const errors: Array = []; let operation: ?OperationDefinitionNode; const fragments: {[name: string]: FragmentDefinitionNode} =