Index: abp/filters/sources.py |
=================================================================== |
--- a/abp/filters/sources.py |
+++ b/abp/filters/sources.py |
@@ -21,7 +21,8 @@ |
try: |
from urllib2 import urlopen, HTTPError |
-except ImportError: # The module was renamed in Python 3. |
+except ImportError: # pragma: no py2 cover |
+ # The module was renamed in Python 3 |
from urllib.request import urlopen |
from urllib.error import HTTPError |
@@ -174,8 +175,10 @@ |
encoding = get_param('charset') or self.default_encoding |
for line in response: |
yield line.decode(encoding).rstrip() |
- except HTTPError as err: |
- if err.code == 404: |
- raise NotFound("HTTP 404 Not found: '{}:{}'" |
- .format(self.protocol, path_in_source)) |
- raise err |
+ except (HTTPError, ValueError) as err: |
+ try: |
+ if err.code == 404: |
+ raise NotFound("HTTP 404 Not found: '{}:{}'" |
+ .format(self.protocol, path_in_source)) |
+ except AttributeError: # Need to catch so the real err is raised |
+ raise err |
Sebastian Noack
2018/12/28 00:22:51
Previously, when we got an HTTPError with a code o
rhowell
2018/12/28 21:50:07
Ah, you're right, thanks.
|