Skip to content

Commit

Permalink
Panic less (#201)
Browse files Browse the repository at this point in the history
This not only cause panic, but also makes query never finish and our
debugging sucks. Found during Hydr
  • Loading branch information
jakozaur authored May 23, 2024
1 parent 3bcbc14 commit 1c28236
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions quesma/quesma/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ func (q *QueryRunner) handleSearchCommon(ctx context.Context, indexPattern strin
})
columnsSlice := [][]string{columns}
translatedQueryBody, hitsSlice := q.searchWorker(ctx, queries, columnsSlice, table, doneCh, optAsync)
if len(hitsSlice) == 0 {
logger.ErrorWithCtx(ctx).Msgf("no hits, queryInfo: %d", translatedQueryBody)
doneCh <- AsyncSearchWithError{translatedQueryBody: translatedQueryBody, err: errors.New("no hits")}
return
}
searchResponse, err := queryTranslator.MakeSearchResponse(hitsSlice[0], queries[0])
if err != nil {
logger.ErrorWithCtx(ctx).Msgf("error making response: %v, queryInfo: %+v, rows: %v", err, queries[0].QueryInfo, hitsSlice[0])
Expand Down

0 comments on commit 1c28236

Please sign in to comment.