@@ -41,34 +41,24 @@ type VariableUsage = {|
41
41
*/
42
42
export class ASTValidationContext {
43
43
_ast : DocumentNode ;
44
- _onError: ?( err : GraphQLError ) => void ;
45
- _errors: Array < GraphQLError > ;
44
+ _onError: ( err : GraphQLError ) => void ;
46
45
_fragments: ?ObjMap < FragmentDefinitionNode > ;
47
46
_fragmentSpreads: Map < SelectionSetNode , $ReadOnlyArray < FragmentSpreadNode >> ;
48
47
_recursivelyReferencedFragments: Map <
49
48
OperationDefinitionNode ,
50
49
$ReadOnlyArray < FragmentDefinitionNode > ,
51
50
> ;
52
51
53
- constructor ( ast : DocumentNode , onError ? : ( err : GraphQLError ) => void ) : void {
52
+ constructor ( ast : DocumentNode , onError : ( err : GraphQLError ) = > void ) : void {
54
53
this. _ast = ast ;
55
- this . _errors = [ ] ;
56
54
this . _fragments = undefined ;
57
55
this . _fragmentSpreads = new Map ( ) ;
58
56
this . _recursivelyReferencedFragments = new Map ( ) ;
59
57
this . _onError = onError ;
60
58
}
61
59
62
60
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 ) ;
72
62
}
73
63
74
64
getDocument ( ) : DocumentNode {
@@ -175,7 +165,7 @@ export class ValidationContext extends ASTValidationContext {
175
165
schema : GraphQLSchema ,
176
166
ast : DocumentNode ,
177
167
typeInfo : TypeInfo ,
178
- onError ? : ( err : GraphQLError ) => void ,
168
+ onError : ( err : GraphQLError ) = > void ,
179
169
) : void {
180
170
super ( ast , onError ) ;
181
171
this . _schema = schema ;
0 commit comments