1
0

All error pages was replaced by a universal error page.

This commit is contained in:
Alexander Andreev 2023-05-27 20:47:06 +04:00
parent bf3cb9f9bf
commit d828c3adde
Signed by: Arav
GPG Key ID: D22A817D95815393
5 changed files with 13 additions and 98 deletions

View File

@ -176,19 +176,6 @@ func SitemapXml(w http.ResponseWriter, r *http.Request) {
w.Write(data) w.Write(data)
} }
/**** Errors ******************************************************************/ func Error(w http.ResponseWriter, code int, reason, message string) {
web.ErrorXXX("/"+http.StatusText(code), reason, message, code, w)
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)
} }

View File

@ -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

View File

@ -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

View File

@ -1,7 +1,7 @@
extends base.pug extends base.pug
block meta_description block meta_description
meta(name='description' content='Not Found') meta(name='description' content=http.StatusText(code))
block append head block append head
style(type="text/css"). style(type="text/css").
@ -19,10 +19,14 @@ block nav
a(href='/mindflow') Mindflow a(href='/mindflow') Mindflow
a(href='/about') About a(href='/about') About
a(href='/guestbook') Guestbook a(href='/guestbook') Guestbook
h1 Oh, you lost? Bad for ya. h1 #{http.StatusText(code)}
block content block content
:go:func NotFound(title string) :go:func ErrorXXX(title, reason, message string, code int)
section#error section#error
h1 404 h1 #{code}
| Page Not Found | #{http.StatusText(code)}
if reason != ""
p #{reason}
if message != ""
p #{message}

View File

@ -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 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 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 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 article.pug
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer errorXXX.pug
//go:generate $GOPATH/bin/jade -basedir ./templates -pkg=web -writer error403.pug error404.pug error500.pug
//go:embed assets //go:embed assets
var assetsDir embed.FS var assetsDir embed.FS