Skip to content

Commit

Permalink
Close/Return helm request when there is an error
Browse files Browse the repository at this point in the history
  • Loading branch information
akashshinde committed Jan 29, 2020
1 parent 0065167 commit d107f9b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/helm/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func (h *HelmHandlers) HandleHelmRenderManifests(user *auth.User, w http.Respons
resp, err := actions.RenderManifests(req.Name, req.ChartUrl, req.Values, conf)
if err != nil {
serverutils.SendResponse(w, http.StatusBadGateway, serverutils.ApiError{fmt.Sprintf("Failed to render manifests: %v", err)})
return
}

w.Header().Set("Content-Type", "text/yaml")
Expand All @@ -54,6 +55,7 @@ func (h *HelmHandlers) HandleHelmInstall(user *auth.User, w http.ResponseWriter,
resp, err := actions.InstallChart(req.Namespace, req.Name, req.ChartUrl, req.Values, conf)
if err != nil {
serverutils.SendResponse(w, http.StatusBadGateway, serverutils.ApiError{fmt.Sprintf("Failed to install helm chart: %v", err)})
return
}

w.Header().Set("Content-Type", "application/json")
Expand All @@ -69,6 +71,7 @@ func (h *HelmHandlers) HandleHelmList(user *auth.User, w http.ResponseWriter, r
resp, err := actions.ListReleases(conf)
if err != nil {
serverutils.SendResponse(w, http.StatusBadGateway, serverutils.ApiError{fmt.Sprintf("Failed to list helm releases: %v", err)})
return
}

w.Header().Set("Content-Type", "application/json")
Expand Down

0 comments on commit d107f9b

Please sign in to comment.