File tree 1 file changed +3
-4
lines changed
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 7
7
* @flow strict
8
8
*/
9
9
10
+ import invariant from '../jsutils/invariant' ;
10
11
import keyMap from '../jsutils/keyMap' ;
11
12
import keyValMap from '../jsutils/keyValMap' ;
12
13
import type { ObjMap } from '../jsutils/ObjMap' ;
@@ -116,9 +117,7 @@ export function buildASTSchema(
116
117
ast : DocumentNode ,
117
118
options ?: BuildSchemaOptions ,
118
119
) : GraphQLSchema {
119
- if ( ! ast || ast . kind !== Kind . DOCUMENT ) {
120
- throw new Error ( 'Must provide a document ast.' ) ;
121
- }
120
+ invariant ( ast && ast . kind === Kind . DOCUMENT , 'Must provide a document ast.' ) ;
122
121
123
122
if ( ! options || ! ( options . assumeValid || options . assumeValidSDL ) ) {
124
123
assertValidSDL ( ast ) ;
@@ -342,7 +341,7 @@ export class ASTDefinitionBuilder {
342
341
case Kind . INPUT_OBJECT_TYPE_DEFINITION :
343
342
return this . _makeInputObjectDef ( def ) ;
344
343
default :
345
- throw new Error ( `Type kind "${ def . kind } " not supported.` ) ;
344
+ invariant ( false , `Type kind "${ def . kind } " not supported.` ) ;
346
345
}
347
346
}
348
347
You can’t perform that action at this time.
0 commit comments