forked from gratipay/gratipay.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.spt
43 lines (37 loc) · 1.13 KB
/
error.spt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from __future__ import absolute_import, division, print_function, unicode_literals
from aspen.http import status_strings
from gratipay.utils import LazyResponse
from gratipay.utils.i18n import HTTP_ERRORS
[----------------------------------------]
try:
_
except NameError:
_ = lambda a: a
banner = _("Eep!")
code = response.code
msg = _(HTTP_ERRORS.get(code, status_strings.get(code, '')))
try:
assert msg
except Exception as e:
website.tell_sentry(e, state)
if isinstance(response, LazyResponse):
response.render_body(state)
err = response.body
if code == 500 and not err:
err = _("Looks like you've found a bug! Sorry for the inconvenience, we'll get it fixed ASAP!")
suppress_sidebar = True
[----------------------------------------] text/html
{% extends "templates/base.html" %}
{% set title = code %}
{% block content %}
<p>{{ msg }}</p>
<pre>{{ err }}</pre>
{% endblock %}
[----------------------------------------] application/json via json_dump
{ "error_code": code
, "error_message_short": msg
, "error_message_long": err
}
[----------------------------------------] text/plain
{{msg}}, program!
{{err}}