mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 06:49:24 +01:00
getUrlFd: chain the original exception so that plugins can handle them further (#1487)
This commit is contained in:
parent
db7ef3f025
commit
09392478e6
@ -153,18 +153,18 @@ def getUrlFd(url, headers=None, data=None, timeout=None):
|
|||||||
fd = urlopen(request, timeout=timeout)
|
fd = urlopen(request, timeout=timeout)
|
||||||
return fd
|
return fd
|
||||||
except socket.timeout as e:
|
except socket.timeout as e:
|
||||||
raise Error(TIMED_OUT)
|
raise Error(TIMED_OUT) from e
|
||||||
except sockerrors as e:
|
except sockerrors as e:
|
||||||
raise Error(strError(e))
|
raise Error(strError(e)) from e
|
||||||
except InvalidURL as e:
|
except InvalidURL as e:
|
||||||
raise Error('Invalid URL: %s' % e)
|
raise Error('Invalid URL: %s' % e) from e
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
raise Error(strError(e))
|
raise Error(strError(e)) from e
|
||||||
except URLError as e:
|
except URLError as e:
|
||||||
raise Error(strError(e.reason))
|
raise Error(strError(e.reason)) from e
|
||||||
# Raised when urllib doesn't recognize the url type
|
# Raised when urllib doesn't recognize the url type
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
raise Error(strError(e))
|
raise Error(strError(e)) from e
|
||||||
|
|
||||||
def getUrlTargetAndContent(url, size=None, headers=None, data=None, timeout=None):
|
def getUrlTargetAndContent(url, size=None, headers=None, data=None, timeout=None):
|
||||||
"""getUrlTargetAndContent(url, size=None, headers=None, data=None, timeout=None)
|
"""getUrlTargetAndContent(url, size=None, headers=None, data=None, timeout=None)
|
||||||
|
Loading…
Reference in New Issue
Block a user