All error pages was replaced by a universal error page.
This commit is contained in:
parent
bf3cb9f9bf
commit
d828c3adde
@ -176,19 +176,6 @@ func SitemapXml(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(data)
|
||||
}
|
||||
|
||||
/**** Errors ******************************************************************/
|
||||
|
||||
func ForbiddenError(err, msg string, w http.ResponseWriter) {
|
||||
w.WriteHeader(http.StatusForbidden)
|
||||
web.ForbiddenError("/ Forbidden", err, msg, w)
|
||||
}
|
||||
|
||||
func NotFound(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNotFound)
|
||||
web.NotFound("Not Found", w)
|
||||
}
|
||||
|
||||
func InternalError(err, msg string, w http.ResponseWriter) {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
web.InternalError("/ Internal Error", err, msg, w)
|
||||
func Error(w http.ResponseWriter, code int, reason, message string) {
|
||||
web.ErrorXXX("/"+http.StatusText(code), reason, message, code, w)
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
extends base.pug
|
||||
|
||||
block meta_description
|
||||
meta(name='description' content='Forbidden')
|
||||
|
||||
block append head
|
||||
style(type="text/css").
|
||||
#error {
|
||||
font-size: 3.5rem;
|
||||
line-height: 5rem;
|
||||
text-align: center;
|
||||
margin: 6rem 0; }
|
||||
|
||||
#error h1 { font-size: 8rem; }
|
||||
|
||||
#description p { text-align: center; }
|
||||
|
||||
#description p:first-child { font-size: 1.4rem; }
|
||||
|
||||
block nav
|
||||
a(href='/') Home
|
||||
a(href='/stuff') Stuff
|
||||
a(href='/mindflow') Mindflow
|
||||
a(href='/about') About
|
||||
a(href='/guestbook') Guestbook
|
||||
h1 Whoa whoa, watcha tryin'?
|
||||
|
||||
block content
|
||||
:go:func ForbiddenError(title, err, msg string)
|
||||
section#error
|
||||
h1 403
|
||||
| Forbidden
|
||||
|
||||
if (err != "")
|
||||
section#description
|
||||
p= err
|
||||
p= msg
|
@ -1,37 +0,0 @@
|
||||
extends base.pug
|
||||
|
||||
block meta_description
|
||||
meta(name='description' content='Internal Server Error')
|
||||
|
||||
block append head
|
||||
style(type="text/css").
|
||||
#error {
|
||||
font-size: 3.5rem;
|
||||
line-height: 5rem;
|
||||
text-align: center;
|
||||
margin: 6rem 0; }
|
||||
|
||||
#error h1 { font-size: 8rem; }
|
||||
|
||||
#description p { text-align: center; }
|
||||
|
||||
#description p:first-child { font-size: 1.4rem; }
|
||||
|
||||
block nav
|
||||
a(href='/') Home
|
||||
a(href='/stuff') Stuff
|
||||
a(href='/mindflow') Mindflow
|
||||
a(href='/about') About
|
||||
a(href='/guestbook') Guestbook
|
||||
h1 Ohh... Shite!
|
||||
|
||||
block content
|
||||
:go:func InternalError(title, err, msg string)
|
||||
section#error
|
||||
h1 50x
|
||||
| Internal Server Error
|
||||
|
||||
if (err != "")
|
||||
section#description
|
||||
p= err
|
||||
p= msg
|
@ -1,7 +1,7 @@
|
||||
extends base.pug
|
||||
|
||||
block meta_description
|
||||
meta(name='description' content='Not Found')
|
||||
meta(name='description' content=http.StatusText(code))
|
||||
|
||||
block append head
|
||||
style(type="text/css").
|
||||
@ -19,10 +19,14 @@ block nav
|
||||
a(href='/mindflow') Mindflow
|
||||
a(href='/about') About
|
||||
a(href='/guestbook') Guestbook
|
||||
h1 Oh, you lost? Bad for ya.
|
||||
h1 #{http.StatusText(code)}
|
||||
|
||||
block content
|
||||
:go:func NotFound(title string)
|
||||
section#error
|
||||
h1 404
|
||||
| Page Not Found
|
||||
:go:func ErrorXXX(title, reason, message string, code int)
|
||||
section#error
|
||||
h1 #{code}
|
||||
| #{http.StatusText(code)}
|
||||
if reason != ""
|
||||
p #{reason}
|
||||
if message != ""
|
||||
p #{message}
|
@ -11,10 +11,8 @@ import (
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer index.pug stuff.pug mindflow.pug
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer about.pug guestbook.pug rss.pug
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer guestbook_admin.pug mindflow_admin.pug
|
||||
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer article.pug
|
||||
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer error403.pug error404.pug error500.pug
|
||||
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer errorXXX.pug
|
||||
|
||||
//go:embed assets
|
||||
var assetsDir embed.FS
|
||||
|
Loading…
Reference in New Issue
Block a user