insights: return unavailable reason rather than error when resolving availability
Created by: leonore
when we determine a mode's availability we can fail on query parsing. we should not fully error on this and return a SearchAggregationNotAvailable
resolver instead
Test plan
query searchQueryAggregate {
searchQueryAggregate(query: "fix fork:file context:global", patternType: literal) {
aggregations(limit: 10) {
__typename
... on ExhaustiveSearchAggregationResult {
groups {
label
count
query
}
otherResultCount
otherGroupCount
}
... on NonExhaustiveSearchAggregationResult {
groups {
label
count
query
}
otherResultCount
approximateOtherGroupCount
}
... on SearchAggregationNotAvailable {
reason
}
}
}
}
returns
{
"data": {
"searchQueryAggregate": {
"aggregations": {
"__typename": "SearchAggregationNotAvailable",
"reason": "could not fetch mode availability: ParseQuery: query.Pipeline: invalid value \"file\" for field \"fork\". Valid values are: yes, only, no"
}
}
}
}