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
After
How to set up and validate locally
- Set up Zoekt
- take the Zoekt webserver down:
gdk stop zoekt-webserver-development
- note the project id that you have setup for Zoekt
- check out master branch
- perform a code search on the project
- 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
- checkout this branch
- perform a code search on the project
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Terri Chu