Skip to content

Handle Zoekt API Errors

Dmitry Gruzd requested to merge 389807-handle-zoekt-api-errors into master

What does this MR do and why?

This is a follow-up from #389743 (closed). We've covered web responses, but we need to do the same for our search API.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Enable Zoekt integration in GDK
  2. Index a project in Zoekt
  3. Use the Zoekt-enabled project ID and your private token to search for * (which is an incorrect query for Zoekt)
❯ curl -v \
  --url 'http://localhost:3000/api/v4/projects/6/search?scope=blobs&search=*' \
  --header 'PRIVATE-TOKEN: <token>'
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000 (#0)
> GET /api/v4/projects/6/search?scope=blobs&search=* HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.86.0
> Accept: */*
> PRIVATE-TOKEN: <token>
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Cache-Control: no-cache
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Request-Id: 01GT1R479RMV662MG24AMR5FGE
< X-Runtime: 0.030952
< Date: Fri, 24 Feb 2023 12:59:47 GMT
< Content-Length: 98
<
* Connection #0 to host localhost left intact
{"message":"400 Bad request - error parsing regexp: missing argument to repetition operator: `*`"}

MR acceptance checklist

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

Related to #389807 (closed)

Edited by Dmitry Gruzd

Merge request reports

Loading