nicer 400 error page
This commit is contained in:
parent
a7ae455ac1
commit
0a1aa869e4
5
pages.go
5
pages.go
|
@ -86,7 +86,10 @@ func oopsHandler(c web.C, w http.ResponseWriter, r *http.Request, rt RespType, m
|
|||
|
||||
func badRequestHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
http.Error(w, http.StatusText(http.StatusBadRequest), http.StatusBadRequest)
|
||||
err := Templates["400.html"].ExecuteWriter(pongo2.Context{}, w)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
}
|
||||
|
||||
func unauthorizedHandler(c web.C, w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -45,8 +45,9 @@ func populateTemplatesMap(tSet *pongo2.TemplateSet, tMap map[string]*pongo2.Temp
|
|||
"index.html",
|
||||
"paste.html",
|
||||
"API.html",
|
||||
"404.html",
|
||||
"400.html",
|
||||
"401.html",
|
||||
"404.html",
|
||||
"oops.html",
|
||||
|
||||
"display/audio.html",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
400 Bad Request
|
||||
{% endblock %}
|
Loading…
Reference in New Issue