forked from liberapay/liberapay.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
error.spt
49 lines (41 loc) · 1.51 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
44
45
46
47
48
49
from __future__ import absolute_import, division, print_function, unicode_literals
from pando.http import status_strings
from liberapay.exceptions import LazyResponse
from liberapay.utils.i18n import HTTP_ERRORS
[----------------------------------------]
code = response.code
msg = _(HTTP_ERRORS.get(code, status_strings.get(code, '')))
try:
assert msg
except Exception as e:
website.tell_sentry(e, state, allow_reraise=True)
if isinstance(response, LazyResponse):
response.render_body(state)
err = response.text
if code == 500 and not err:
err = _("Looks like you've found a bug! Sorry for the inconvenience, we'll get it fixed ASAP!")
[----------------------------------------] text/html
% extends "templates/base.html"
% set title = '' if response.show_sign_in_form else code
% set closed = code == 410 and 'username' in request.path
% block content
% if response.show_sign_in_form
% include "templates/sign-in-form.html"
% elif closed
<p>{{ _("The account owner has closed this account.") }}</p>
% if user.ANON
<h2>{{ _("Are you the account owner?") }}</h2>
<p>{% include "templates/sign-in-link.html" %} {{ _("to reopen your account.") }}</p>
% endif
% else
<p>{{ msg }}</p>
<pre>{{ err }}</pre>
% endif
% endblock
[----------------------------------------] application/json via json_dump
{ "error_code": code
, "error_message_short": msg
, "error_message_long": err
}
[----------------------------------------] text/plain
{{err or msg}}