Suppress extraneous error when ValuesOfCorrectType validation fails #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Because all validation rules are run, and all can report errors, and not just the first one that fails, and because
costAnalysis
depends on input arguments which may failValuesOfCorrectType
validation, an extraneous error was being reported bycostAnalysis
, when it callsgetArgumentValues
, which may make it look like this is the part of the code with the problem, as this error may appear first in theerrors
property array of the query response, and that's all users may look at. (See #29 for an example of where this may have happened).The error when calling
getArgumentValues
is a side-effect of failed validation elsewhere, and should not be reported from this validator.This patch simply breaks out of the cost calculation for the contextual node when this occurs, which may, or may not subsequently report an over-cost error from the rest of the graph, but query execution will fail for the other validation reason anyway.