Skip to content
Snippets Groups Projects

insights: return unavailable reason rather than error when resolving availability

Open Warren Gifford requested to merge leo/make-errors-unavailable-reason into main

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"
      }
    }
  }
}

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading