File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 1212__all__ = ["assert_valid_sdl" , "assert_valid_sdl_extension" , "validate" , "validate_sdl" ]
1313
1414
15- class ValidationAbortedError (RuntimeError ):
15+ class ValidationAbortedError (GraphQLError ):
1616 """Error when a validation has been aborted (error limit reached)."""
1717
1818
19+ validation_aborted_error = ValidationAbortedError (
20+ "Too many validation errors, error limit reached. Validation aborted."
21+ )
22+
23+
1924def validate (
2025 schema : GraphQLSchema ,
2126 document_ast : DocumentNode ,
@@ -54,13 +59,7 @@ def validate(
5459
5560 def on_error (error : GraphQLError ) -> None :
5661 if len (errors ) >= max_errors : # type: ignore
57- errors .append (
58- GraphQLError (
59- "Too many validation errors, error limit reached."
60- " Validation aborted."
61- )
62- )
63- raise ValidationAbortedError
62+ raise validation_aborted_error
6463 errors .append (error )
6564
6665 context = ValidationContext (schema , document_ast , type_info , on_error )
@@ -73,7 +72,7 @@ def on_error(error: GraphQLError) -> None:
7372 try :
7473 visit (document_ast , TypeInfoVisitor (type_info , ParallelVisitor (visitors )))
7574 except ValidationAbortedError :
76- pass
75+ errors . append ( validation_aborted_error )
7776 return errors
7877
7978
You can’t perform that action at this time.
0 commit comments