From aadc20fa1925018e2c1b72ca89ad7f7f123ea74b Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sat, 3 Jul 2021 21:31:45 -0700 Subject: Friendlier error message when Tor is closed or network is down MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jesús --- youtube/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'youtube/__init__.py') diff --git a/youtube/__init__.py b/youtube/__init__.py index 9a5f66c..08f4f6f 100644 --- a/youtube/__init__.py +++ b/youtube/__init__.py @@ -108,6 +108,12 @@ def error_page(e): if exc_info()[1].ip: error_message += '\n\nExit node IP address: ' + exc_info()[1].ip return flask.render_template('error.html', error_message=error_message, slim=slim), 502 + elif exc_info()[0] == util.FetchError and exc_info()[1].error_message: + return (flask.render_template( + 'error.html', + error_message=exc_info()[1].error_message, + slim=slim + ), 502) return flask.render_template('error.html', traceback=traceback.format_exc(), slim=slim), 500 -- cgit v1.2.3