From 79f1875c9da822985367f996329143b088e169b3 Mon Sep 17 00:00:00 2001 From: Starttoaster Date: Mon, 15 Apr 2024 02:01:39 +0000 Subject: [PATCH] Fix errcheck lints --- internal/web/server.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/internal/web/server.go b/internal/web/server.go index 9243bf5..5469a3e 100644 --- a/internal/web/server.go +++ b/internal/web/server.go @@ -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) { @@ -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 + } }