add proper error pages for 404, 500
This commit is contained in:
parent
fcabf262c5
commit
7599565344
|
@ -257,3 +257,10 @@ form.btn-group {
|
|||
.clearfix {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
section > pre.error-log {
|
||||
overflow: auto;
|
||||
padding-top: 2em;
|
||||
padding-bottom: 2em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
|
11
routes.py
11
routes.py
|
@ -54,6 +54,17 @@ def touch_viewer(resp):
|
|||
return resp
|
||||
|
||||
|
||||
@app.errorhandler(404)
|
||||
def not_found(e):
|
||||
return (render_template('404.html', e=e), 404)
|
||||
|
||||
|
||||
@app.errorhandler(500)
|
||||
@app.errorhandler(Exception)
|
||||
def internal_server_error(e):
|
||||
return (render_template('500.html', e=e), 500)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
if g.viewer:
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{% extends 'lib/layout.html' %}
|
||||
|
||||
{% block body -%}
|
||||
<section>
|
||||
<h2>Nothing here</h2>
|
||||
<p>It seems you may have gotten lost. <a href='/'>Head back</a></p>
|
||||
<pre class='error-log'>
|
||||
404 Not Found
|
||||
|
||||
{{e}}</pre>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -0,0 +1,24 @@
|
|||
{% extends 'lib/layout.html' %}
|
||||
|
||||
{% block body -%}
|
||||
|
||||
<section>
|
||||
<h2>Something unexpected happened!</h2>
|
||||
<p>
|
||||
{%- if g.sentry_event_id %}
|
||||
This error has been logged, please try again in a few minutes.
|
||||
{%- else %}
|
||||
Please try again in a few minutes.
|
||||
{%- endif %}
|
||||
</p>
|
||||
<pre class='error-log'>
|
||||
500 Internal server error
|
||||
|
||||
{{e}}
|
||||
|
||||
{%- if g.sentry_event_id %}
|
||||
sentry://{{ g.sentry_event_id }}
|
||||
{%- endif %}</pre>
|
||||
</section>
|
||||
|
||||
{%- endblock %}
|
Loading…
Reference in New Issue