runservice: handle run not existing

Check if the response from the readdb is null and return an http not found error
This commit is contained in:
Simone Gotti 2019-07-08 09:30:15 +02:00
parent 8c2f37d47c
commit 45a460ebc0
1 changed files with 4 additions and 0 deletions

View File

@ -396,6 +396,10 @@ func (h *RunHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if run == nil {
httpError(w, util.NewErrNotFound(errors.Errorf("run %q doesn't exist", runID)))
return
}
cgts, err := types.MarshalChangeGroupsUpdateToken(cgt)
if err != nil {