Handle error template errors (#332)

This commit is contained in:
Ben Wells 2020-06-18 01:01:02 +01:00 committed by GitHub
parent 82412aced6
commit 87505f1a42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -407,12 +407,15 @@ func renderHTTPError(log logrus.FieldLogger, r *http.Request, w http.ResponseWri
errMsg := fmt.Sprintf("%+v", err)
w.WriteHeader(code)
templates.ExecuteTemplate(w, "error", map[string]interface{}{
if templateErr := templates.ExecuteTemplate(w, "error", map[string]interface{}{
"session_id": sessionID(r),
"request_id": r.Context().Value(ctxKeyRequestID{}),
"error": errMsg,
"status_code": code,
"status": http.StatusText(code)})
"status": http.StatusText(code),
}); templateErr != nil {
log.Println(templateErr)
}
}
func currentCurrency(r *http.Request) string {