diff options
author | James Taylor <user234683@users.noreply.github.com> | 2019-12-20 20:21:29 -0800 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2019-12-20 20:21:29 -0800 |
commit | 98fbdf77cb7af6d49bbd981765ac84824fe114c2 (patch) | |
tree | c21f74269919a5603fac2a43bf06d6c9d645dbba /youtube/__init__.py | |
parent | 80de90b1bbccdfc8bc3f8f48b8059125f14f0945 (diff) | |
download | yt-local-98fbdf77cb7af6d49bbd981765ac84824fe114c2.tar.lz yt-local-98fbdf77cb7af6d49bbd981765ac84824fe114c2.tar.xz yt-local-98fbdf77cb7af6d49bbd981765ac84824fe114c2.zip |
Add custom 500 error page. Display the traceback. Center and format error page in general.
Also add a link to github for reporting the exception.
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r-- | youtube/__init__.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/youtube/__init__.py b/youtube/__init__.py index 534b9f8..d8171c0 100644 --- a/youtube/__init__.py +++ b/youtube/__init__.py @@ -1,5 +1,6 @@ import flask import settings +import traceback yt_app = flask.Flask(__name__) yt_app.url_map.strict_slashes = False @@ -30,3 +31,7 @@ def commatize(num): if isinstance(num, str): num = int(num) return '{:,}'.format(num) + +@yt_app.errorhandler(500) +def error_page(e): + return flask.render_template('error.html', traceback=traceback.format_exc()), 500 |