flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 7e0b032dd3df947f42db5dd912a424c88ce03c03
parent d865a8dbc32bcff967a9cf8733d2eda2f36f4889
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Tue, 20 Oct 2020 22:27:53 -0700

fix from previous commit

Diffstat:
Mhttp.go | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/http.go b/http.go @@ -17,7 +17,6 @@ type IndexHandler struct { 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 renderError(w http.ResponseWriter, errorMsg string) { // TODO think about p 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 @@ func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { }{h.Domain, h.SiteTitle, indexFiles, allUsers} err = t.ExecuteTemplate(w, "index.html", data) if err != nil { + w.WriteHeader(http.StatusInternalServerError) renderError(w, InternalServerError) return }