aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/util.py
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-07-28 23:45:19 -0500
committerJesús <heckyel@hyperbola.info>2021-07-28 23:45:19 -0500
commitf5f9b1c18172327ec310efc9274db30959ba334e (patch)
tree8a1ba232fef71c76e4c016b7403d9336c3daed3d /youtube/util.py
parentd0e3adab0115c547eb58d34337dca7bfce629be2 (diff)
downloadyt-local-f5f9b1c18172327ec310efc9274db30959ba334e.tar.lz
yt-local-f5f9b1c18172327ec310efc9274db30959ba334e.tar.xz
yt-local-f5f9b1c18172327ec310efc9274db30959ba334e.zip
Cleaner channel-checking console error messages when Tor is closed
by James Taylor <user234683@users.noreply.github.com>
Diffstat (limited to 'youtube/util.py')
-rw-r--r--youtube/util.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube/util.py b/youtube/util.py
index e62d575..daec2df 100644
--- a/youtube/util.py
+++ b/youtube/util.py
@@ -194,7 +194,11 @@ class HTTPAsymmetricCookieProcessor(urllib.request.BaseHandler):
class FetchError(Exception):
def __init__(self, code, reason='', ip=None, error_message=None):
- Exception.__init__(self, 'HTTP error during request: ' + code + ' ' + reason)
+ if error_message:
+ string = code + ' ' + reason + ': ' + error_message
+ else:
+ string = 'HTTP error during request: ' + code + ' ' + reason
+ Exception.__init__(self, string)
self.code = code
self.reason = reason
self.ip = ip