Friendlify the error page.
This commit is contained in:
parent
7e617c1769
commit
37f3607ebc
|
@ -13,6 +13,8 @@ from .base import BasePage
|
||||||
# Avoid showing the request in the traceback variable inspectors
|
# Avoid showing the request in the traceback variable inspectors
|
||||||
inspector.blacklist_types += (Request,)
|
inspector.blacklist_types += (Request,)
|
||||||
|
|
||||||
|
ENDUSER_TEXT = """We're sorry, but it looks like something went wrong. Please try refreshing the page or navigating back to the homepage. If the issue persists, our technical team is working to resolve it as soon as possible. We apologize for the inconvenience and appreciate your patience.""" # noqa: E501
|
||||||
|
|
||||||
|
|
||||||
class ErrorPage(BasePage):
|
class ErrorPage(BasePage):
|
||||||
STYLE_APPEND = tracerite.html.style
|
STYLE_APPEND = tracerite.html.style
|
||||||
|
@ -63,6 +65,8 @@ class ErrorPage(BasePage):
|
||||||
)
|
)
|
||||||
|
|
||||||
if not debug:
|
if not debug:
|
||||||
|
with self.doc.div(id="enduser"):
|
||||||
|
self.doc.p(ENDUSER_TEXT).p.a("Front Page", href="/")
|
||||||
return
|
return
|
||||||
# Show additional details in debug mode,
|
# Show additional details in debug mode,
|
||||||
# open by default for 500 errors
|
# open by default for 500 errors
|
||||||
|
@ -71,7 +75,7 @@ class ErrorPage(BasePage):
|
||||||
extra = getattr(self.exc, "extra", None)
|
extra = getattr(self.exc, "extra", None)
|
||||||
if extra:
|
if extra:
|
||||||
self._key_value_table(
|
self._key_value_table(
|
||||||
"Exception extra data", "exception-extra", extra
|
"Issue extra data", "exception-extra", extra
|
||||||
)
|
)
|
||||||
|
|
||||||
self.doc.summary(
|
self.doc.summary(
|
||||||
|
|
|
@ -1,4 +1,16 @@
|
||||||
/** ErrorPage **/
|
/** ErrorPage **/
|
||||||
|
#enduser {
|
||||||
|
max-width: 30em;
|
||||||
|
margin: 5em auto 5em auto;
|
||||||
|
text-align: justify;
|
||||||
|
text-justify: both;
|
||||||
|
}
|
||||||
|
#enduser a {
|
||||||
|
color: var(--sanic-blue);
|
||||||
|
}
|
||||||
|
#enduser p:last-child {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
summary {
|
summary {
|
||||||
margin-top: 3em;
|
margin-top: 3em;
|
||||||
color: var(--sanic-blue);
|
color: var(--sanic-blue);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user