Add error checking for template loading and writing
This commit is contained in:
parent
59fcb1fc47
commit
462ee38b96
|
|
@ -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/index.html",
|
||||||
os.Getenv("EKSTER_TEMPLATES")+"/templates/settings.html",
|
os.Getenv("EKSTER_TEMPLATES")+"/templates/settings.html",
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(w, "ERROR: %q\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var page indexPage
|
var page indexPage
|
||||||
page.Session = sess
|
page.Session = sess
|
||||||
|
|
||||||
err = t.ExecuteTemplate(w, "index", page)
|
err = t.ExecuteTemplate(w, "index", page)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(w, "ERROR: %q\n", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
return
|
return
|
||||||
} else if r.URL.Path == "/auth/callback" {
|
} else if r.URL.Path == "/auth/callback" {
|
||||||
c, err := r.Cookie("session")
|
c, err := r.Cookie("session")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user