コード例 #1
0
ファイル: controllers.go プロジェクト: shirkevich/goffee
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)
	}
}
コード例 #2
0
ファイル: controllers.go プロジェクト: shirkevich/goffee
// 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)
	}
}