Example #1
0
func renderError(c web.C, w http.ResponseWriter, req *http.Request, message string, status int) {
	templates := render.GetBaseTemplates()
	templates = append(templates, "web/views/error.html")
	err := render.Template(c, w, req, templates, "layout", map[string]interface{}{"Status": status, "Message": message})
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
Example #2
0
// NotFound serves the 404 page
func NotFound(c web.C, w http.ResponseWriter, req *http.Request) {
	templates := render.GetBaseTemplates()
	templates = append(templates, "web/views/404.html")
	err := render.Template(c, w, req, templates, "layout", map[string]interface{}{})
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}