DRYed up the OSError/socket.gaierror handler.

This commit is contained in:
Jake Basile 2013-07-18 13:07:25 -05:00
parent 262652992d
commit cc81a0e8da

View File

@ -206,11 +206,7 @@ def get_AAAA(host, resolver=None):
recs = socket.getaddrinfo(host, None, socket.AF_INET6,
socket.SOCK_STREAM)
return [rec[4][0] for rec in recs]
except socket.gaierror:
log.debug("DNS: Error retreiving AAAA address " + \
"info for %s." % host)
return []
except OSError:
except (OSError, socket.gaierror):
log.debug("DNS: Error retreiving AAAA address " + \
"info for %s." % host)
return []