[networking] Handle ConnectionError exceptions
This commit is contained in:
parent
3b8195b81b
commit
6415e4a697
1 changed files with 4 additions and 0 deletions
|
@ -31,6 +31,8 @@ def headers(url):
|
||||||
try:
|
try:
|
||||||
conn.request("HEAD", o.path, None, {"User-agent":
|
conn.request("HEAD", o.path, None, {"User-agent":
|
||||||
"Nemubot v%s" % __version__})
|
"Nemubot v%s" % __version__})
|
||||||
|
except ConnectionError as e:
|
||||||
|
raise IRCException(e.strerror)
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
raise IRCException("request timeout")
|
raise IRCException("request timeout")
|
||||||
except socket.gaierror:
|
except socket.gaierror:
|
||||||
|
@ -68,6 +70,8 @@ def fetch(url, onNone=_onNoneDefault):
|
||||||
return onNone()
|
return onNone()
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
except ConnectionError as e:
|
||||||
|
raise IRCException(e.strerror)
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
raise IRCException("The request timeout when trying to access the page")
|
raise IRCException("The request timeout when trying to access the page")
|
||||||
except socket.error as e:
|
except socket.error as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue