fix from previous commit
alex wennerberg alex@alexwennerberg.com
Tue, 20 Oct 2020 22:27:53 -0700
1 files changed,
3 insertions(+),
1 deletions(-)
jump to
M
http.go
→
http.go
@@ -17,7 +17,6 @@
const InternalServerError = "500: Internal Server Error" func renderError(w http.ResponseWriter, errorMsg string) { // TODO think about pointers - w.WriteHeader(http.StatusInternalServerError) log.Println(errorMsg) data := struct{ ErrorMsg string }{errorMsg} err := t.ExecuteTemplate(w, "error.html", data)@@ -29,11 +28,13 @@
func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { indexFiles, err := getIndexFiles() if err != nil { + w.WriteHeader(http.StatusInternalServerError) renderError(w, InternalServerError) return } allUsers, err := getUsers() if err != nil { + w.WriteHeader(http.StatusInternalServerError) renderError(w, InternalServerError) return }@@ -45,6 +46,7 @@ Users []string
}{h.Domain, h.SiteTitle, indexFiles, allUsers} err = t.ExecuteTemplate(w, "index.html", data) if err != nil { + w.WriteHeader(http.StatusInternalServerError) renderError(w, InternalServerError) return }