From 98fbdf77cb7af6d49bbd981765ac84824fe114c2 Mon Sep 17 00:00:00 2001 From: James Taylor Date: Fri, 20 Dec 2019 20:21:29 -0800 Subject: 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. --- youtube/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'youtube/__init__.py') 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 -- cgit v1.2.3