all repos — flounder @ d105e77524d5c2cb84c198b364de43d0e83cb8f1

A small site builder for the Gemini protocol

cleanup errors
alex wennerberg alex@alexwennerberg.com
Sat, 24 Oct 2020 11:35:43 -0700
commit

d105e77524d5c2cb84c198b364de43d0e83cb8f1

parent

4b85797053e9433b25d6961b53092975a66c6a45

2 files changed, 8 insertions(+), 3 deletions(-)

jump to
M http.gohttp.go

@@ -20,7 +20,10 @@

const InternalServerErrorMsg = "500: Internal Server Error" func renderError(w http.ResponseWriter, errorMsg string, statusCode int) { - data := struct{ ErrorMsg string }{errorMsg} + data := struct { + PageTitle string + ErrorMsg string + }{"Error!", errorMsg} err := t.ExecuteTemplate(w, "error.html", data) if err != nil { // shouldn't happen probably http.Error(w, errorMsg, statusCode)

@@ -58,7 +61,6 @@ log.Println(err)

renderError(w, InternalServerErrorMsg, 500) return } - } func editFileHandler(w http.ResponseWriter, r *http.Request) {
M templates/error.htmltemplates/error.html

@@ -1,1 +1,4 @@

-{{ .ErrorMsg }} +{{template "header" .}} +<h1>Error</h1> +<div class="error">{{ .ErrorMsg }}</div> +{{template "footer" .}}