From ba9e9ab9abfa9bda5cd842b2c9afa7be426ee853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Gramain?= Date: Sat, 11 May 2024 18:49:57 +0200 Subject: [PATCH] lint --- main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index b957656..53c10ca 100644 --- a/main.go +++ b/main.go @@ -71,14 +71,18 @@ func errorHandler(w http.ResponseWriter, r *http.Request) { generateInternalServerError(w, err) return } - t.Execute(w, errorData) + if err := t.Execute(w, errorData); err != nil { + log.Error(err) + } } func generateInternalServerError(w http.ResponseWriter, err error) { log.Println(err) w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(http.StatusInternalServerError) - w.Write([]byte(`{"error": "Internal Server Error"}`)) + if _, err := w.Write([]byte(`{"error": "Internal Server Error"}`)); err != nil { + log.Error(err) + } } func headersHandler(w http.ResponseWriter, r *http.Request) {