@@ -19,19 +19,21 @@ pub enum Error {
1919
2020 #[ error( "schema document validation failed" ) ]
2121 SchemaDocumentValidation {
22+ mutation : String ,
2223 doc : Document ,
2324 errors : WithErrors < Schema > ,
2425 } ,
2526
2627 #[ error( "executable document validation failed" ) ]
2728 ExecutableDocumentValidation {
29+ mutation : String ,
2830 doc : Document ,
2931 schema : Valid < Schema > ,
3032 errors : WithErrors < ExecutableDocument > ,
3133 } ,
3234
3335 #[ error( "validation passed, but should have failed" ) ]
34- SchemaExpectedValidationFail { doc : Document , mutation : String } ,
36+ SchemaExpectedValidationFail { mutation : String , doc : Document } ,
3537
3638 #[ error( "the serialized AST did not round trip to an identical AST" ) ]
3739 SerializationInconsistency { original : Document , new : Document } ,
@@ -48,12 +50,14 @@ pub enum Error {
4850
4951 #[ error( "reparse error" ) ]
5052 SchemaReparse {
53+ mutation : String ,
5154 doc : Document ,
5255 errors : WithErrors < Document > ,
5356 } ,
5457
5558 #[ error( "reparse error" ) ]
5659 ExecutableReparse {
60+ mutation : String ,
5761 schema : Valid < Schema > ,
5862 doc : Document ,
5963 errors : WithErrors < Document > ,
@@ -89,6 +93,7 @@ pub fn generate_schema_document(u: &mut Unstructured) -> Result<Document, Error>
8993 // Let's reparse the document to check that it can be parsed
9094 let reparsed = Document :: parse ( new_doc. to_string ( ) , PathBuf :: from ( "synthetic" ) )
9195 . map_err ( |e| Error :: SchemaReparse {
96+ mutation : mutation. type_name ( ) . to_string ( ) ,
9297 doc : new_doc. clone ( ) ,
9398 errors : e,
9499 } ) ?;
@@ -109,6 +114,7 @@ pub fn generate_schema_document(u: &mut Unstructured) -> Result<Document, Error>
109114 }
110115 ( true , Err ( e) ) => {
111116 return Err ( Error :: SchemaDocumentValidation {
117+ mutation : mutation. type_name ( ) . to_string ( ) ,
112118 doc : new_doc,
113119 errors : e,
114120 } ) ;
@@ -154,6 +160,7 @@ pub(crate) fn generate_executable_document(
154160 // Let's reparse the document to check that it can be parsed
155161 let reparsed = Document :: parse ( new_doc. to_string ( ) , PathBuf :: from ( "synthetic" ) )
156162 . map_err ( |e| Error :: ExecutableReparse {
163+ mutation : mutation. type_name ( ) . to_string ( ) ,
157164 schema : schema. clone ( ) ,
158165 doc : new_doc. clone ( ) ,
159166 errors : e,
@@ -173,15 +180,16 @@ pub(crate) fn generate_executable_document(
173180 }
174181 ( true , Err ( e) ) => {
175182 return Err ( Error :: ExecutableDocumentValidation {
183+ mutation : mutation. type_name ( ) . to_string ( ) ,
176184 doc : new_doc,
177185 schema : schema. clone ( ) ,
178186 errors : e,
179187 } ) ;
180188 }
181189 ( false , Ok ( _) ) => {
182190 return Err ( Error :: SchemaExpectedValidationFail {
183- doc : new_doc,
184191 mutation : mutation. type_name ( ) . to_string ( ) ,
192+ doc : new_doc,
185193 } ) ;
186194 }
187195 ( false , Err ( _) ) => {
0 commit comments