diff --git a/gallery_dl/downloader/http.py b/gallery_dl/downloader/http.py index 54750ac7..c8aeef88 100644 --- a/gallery_dl/downloader/http.py +++ b/gallery_dl/downloader/http.py @@ -144,7 +144,16 @@ class HttpDownloader(DownloaderBase): proxies=self.proxies, verify=self.verify, ) - except (ConnectionError, Timeout) as exc: + except ConnectionError as exc: + try: + reason = exc.args[0].reason + cls = reason.__class__.__name__ + pre, _, err = str(reason.args[-1]).partition(":") + msg = "{}: {}".format(cls, (err or pre).lstrip()) + except Exception: + msg = str(exc) + continue + except Timeout as exc: msg = str(exc) continue except Exception as exc: diff --git a/gallery_dl/extractor/common.py b/gallery_dl/extractor/common.py index c0f4d9c1..ddb60c55 100644 --- a/gallery_dl/extractor/common.py +++ b/gallery_dl/extractor/common.py @@ -172,8 +172,16 @@ class Extractor(): while True: try: response = session.request(method, url, **kwargs) - except (requests.exceptions.ConnectionError, - requests.exceptions.Timeout, + except requests.exceptions.ConnectionError as exc: + code = 0 + try: + reason = exc.args[0].reason + cls = reason.__class__.__name__ + pre, _, err = str(reason.args[-1]).partition(":") + msg = " {}: {}".format(cls, (err or pre).lstrip()) + except Exception: + msg = exc + except (requests.exceptions.Timeout, requests.exceptions.ChunkedEncodingError, requests.exceptions.ContentDecodingError) as exc: msg = exc