Skip to content

search: remove alert handling from doResults

Warren Gifford requested to merge sh/refactor-alerting into main

Created by: stefanhengl

This prepares our codebase for streaming alerts, by bundling the logic around alerts in a function alertForErr(err), which we can call from streaming as well as batch search.

We move most of the alert handling from doResults 1 layer up to resultsWithTimeoutSuggestion. doResults is called from other call sites too, but none of the other callers checks for alerts. We still have to change determineRepos to return a simple error instead of an alert and an error, but I reserve this for the next PR.

Notes:

  • I updated this PR significantly since the last review, so I think it is good to review it again.
  • The function unhandledError could be simplified a bit if we changed doResults to return a multi-error instead of an error interface. However, I think it is ok to add a bit of complexity here to maintain the convention of returning error.

Merge request reports

Loading