Closed Pirokiko closed 6 years ago
This already has been disussed here https://github.com/Youshido/GraphQL/issues/106 . As you are batching I assume you iterate over the batched array anyway so you can just call clearErrors by yourself.
I guess i need to upgrade my search skills, thanks for the reference to the issue. I'll close the issue considering the discussion in #106.
When multiple queries are batched together, it appears that errors in one query are retained and consequently also added to the response for the following queries. This happens even if one of the following queries is executing correctly, such that we have the situation that a query returns both a result as well as errors (which i believe is in conflict with the GraphQL spec).
Example: I used the default hello world example
For this the first and last queries work fine, while the second and third throw an error. This results in the following response
I did not expect to see the "Problem found: error" message in the third query result. The last query result appears to be in conflict with the spec as it is returning both a data response and errors (even though those errors did not occur during that query execution)
The fix appears to be quite simple: In the processPayload method of the Processor class add a line at the top to reset the errors in the execution context. The data is also reset there so it makes sense to also reset the errors at that point. This does seem to fix the issues laid above.
However, since i have no clue of the impact of doing this, i hope someone else can take a look at this.