all repos — flounder @ 7e0b032dd3df947f42db5dd912a424c88ce03c03

A small site builder for the Gemini protocol

fix from previous commit
alex wennerberg alex@alexwennerberg.com
Tue, 20 Oct 2020 22:27:53 -0700
commit

7e0b032dd3df947f42db5dd912a424c88ce03c03

parent

d865a8dbc32bcff967a9cf8733d2eda2f36f4889

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M http.gohttp.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 }