Skip to content

cmd/gitserver/server: Handle warning error in handleRepoUpdate

Warren Gifford requested to merge ig/handle-warning-error into main

Created by: indradhanush

Note to reviewers: The diff is easier to see with whitespaces hidden.

In this commit we start handling a potential warning type error that might be returned from underlying functions. To do this we have to make some minor structural changes to this method:

  • We start returning early at the cost of a little bit of repeated code to JSON encode the response
  • This also has the positive side effect of reducing nesting in the code

Test plan

The updated code path to return the custom 555 status code is technically dead code since none of the underlying methods return a warning type error yet. Once implemented, I will add tests in the client to handle this status code –– which is where the new effect of this code change will be truly seen.

Merge request reports

Loading