Skip to content

Commit

Permalink
Fix errcheck lints
Browse files Browse the repository at this point in the history
  • Loading branch information
Starttoaster committed Apr 15, 2024
1 parent e05dc47 commit 79f1875
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions internal/web/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ func imagesHandler(w http.ResponseWriter, r *http.Request) {
}
imageData := images.GetImagesView(data)

tmpl.Execute(w, imageData)
err = tmpl.Execute(w, imageData)
if err != nil {
log.Logger.Error("encountered error executing image html template", "error", err)
http.Error(w, "Internal Server Error, check server logs", http.StatusInternalServerError)
return
}
}

func imageHandler(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -118,5 +123,10 @@ func imageHandler(w http.ResponseWriter, r *http.Request) {
}
view = images.SortImageVulnerabilityView(view)

tmpl.Execute(w, view)
err = tmpl.Execute(w, view)
if err != nil {
log.Logger.Error("encountered error executing image html template", "error", err)
http.Error(w, "Internal Server Error, check server logs", http.StatusInternalServerError)
return
}
}

0 comments on commit 79f1875

Please sign in to comment.