Add error checking for template loading and writing

This commit is contained in:
Peter Stuifzand 2018-07-09 22:09:45 +02:00
parent 59fcb1fc47
commit 462ee38b96

View File

@ -118,11 +118,19 @@ func (h *mainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
os.Getenv("EKSTER_TEMPLATES")+"/templates/index.html",
os.Getenv("EKSTER_TEMPLATES")+"/templates/settings.html",
)
if err != nil {
fmt.Fprintf(w, "ERROR: %q\n", err)
return
}
var page indexPage
page.Session = sess
err = t.ExecuteTemplate(w, "index", page)
if err != nil {
fmt.Fprintf(w, "ERROR: %q\n", err)
return
}
return
} else if r.URL.Path == "/auth/callback" {
c, err := r.Cookie("session")