Skip to content

Add handling for Zoekt client connection errors

What does this MR do and why?

Noticed while working on gitlab-com/gl-infra/production#17266 (closed). There is error handling for errors returned from the Zoekt client, but not exceptions from connecting to the Zoekt client (think HTTP 504, etc)

This MR:

  • adds a new error class to the existing zoekt errors module (slight refactor to rename the file)
  • raises that error when JSON parsing fails or an HTTP error is returned while connecting to the Zoekt client
  • adds a catch for the new error and backoff errors in zoekt search
  • update specs

Screenshots or screen recordings

Before

image image

After

image

How to set up and validate locally

  1. Set up Zoekt
  2. take the Zoekt webserver down: gdk stop zoekt-webserver-development
  3. note the project id that you have setup for Zoekt
  4. check out master branch
  5. perform a code search on the project
  6. refresh it a few times in the browser, you should get 2 unhandled exceptions. One for the connection error and one for the node backoff
  7. checkout this branch
  8. perform a code search on the project
  9. refresh it a few times in the browser and search page returns with an error message

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Terri Chu

Merge request reports