@@ -41,34 +41,24 @@ type VariableUsage = {|
4141 */
4242export class ASTValidationContext {
4343 _ast : DocumentNode ;
44- _onError: ?( err : GraphQLError ) => void ;
45- _errors: Array < GraphQLError > ;
44+ _onError: ( err : GraphQLError ) => void ;
4645 _fragments: ?ObjMap < FragmentDefinitionNode > ;
4746 _fragmentSpreads: Map < SelectionSetNode , $ReadOnlyArray < FragmentSpreadNode >> ;
4847 _recursivelyReferencedFragments: Map <
4948 OperationDefinitionNode ,
5049 $ReadOnlyArray < FragmentDefinitionNode > ,
5150 > ;
5251
53- constructor ( ast : DocumentNode , onError ? : ( err : GraphQLError ) => void ) : void {
52+ constructor ( ast : DocumentNode , onError : ( err : GraphQLError ) = > void ) : void {
5453 this. _ast = ast ;
55- this . _errors = [ ] ;
5654 this . _fragments = undefined ;
5755 this . _fragmentSpreads = new Map ( ) ;
5856 this . _recursivelyReferencedFragments = new Map ( ) ;
5957 this . _onError = onError ;
6058 }
6159
6260 reportError ( error : GraphQLError ) : void {
63- this. _errors . push ( error ) ;
64- if ( this . _onError ) {
65- this . _onError ( error ) ;
66- }
67- }
68-
69- // @deprecated : use onError callback instead - will be removed in v15.
70- getErrors ( ) : $ReadOnlyArray < GraphQLError > {
71- return this . _errors ;
61+ this. _onError ( error ) ;
7262 }
7363
7464 getDocument ( ) : DocumentNode {
@@ -149,7 +139,7 @@ export class SDLValidationContext extends ASTValidationContext {
149139 constructor (
150140 ast : DocumentNode ,
151141 schema : ?GraphQLSchema ,
152- onError ? : ( err : GraphQLError ) => void ,
142+ onError : ( err : GraphQLError ) = > void ,
153143 ) : void {
154144 super ( ast , onError ) ;
155145 this . _schema = schema ;
@@ -175,7 +165,7 @@ export class ValidationContext extends ASTValidationContext {
175165 schema : GraphQLSchema ,
176166 ast : DocumentNode ,
177167 typeInfo : TypeInfo ,
178- onError ? : ( err : GraphQLError ) => void ,
168+ onError : ( err : GraphQLError ) = > void ,
179169 ) : void {
180170 super ( ast , onError ) ;
181171 this . _schema = schema ;
0 commit comments