aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/__init__.py
diff options
context:
space:
mode:
authorJames Taylor <user234683@users.noreply.github.com>2021-07-03 21:31:45 -0700
committerJesús <heckyel@hyperbola.info>2021-07-04 13:20:48 -0500
commitaadc20fa1925018e2c1b72ca89ad7f7f123ea74b (patch)
treedf40f3af9e9444b5fc8c9db8bbd3a7ef63345aed /youtube/__init__.py
parent7f67af10315f89d196c7380e0f2cbbb8c7b5aa5e (diff)
downloadyt-local-aadc20fa1925018e2c1b72ca89ad7f7f123ea74b.tar.lz
yt-local-aadc20fa1925018e2c1b72ca89ad7f7f123ea74b.tar.xz
yt-local-aadc20fa1925018e2c1b72ca89ad7f7f123ea74b.zip
Friendlier error message when Tor is closed or network is down
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r--youtube/__init__.py6
1 files changed, 6 insertions, 0 deletions
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