Avoid catching generic exception

Replaced 'except Exception' with 'netaddr.AddrFormatError' which
will be raised if address is specified as empty string.

TrivialFix

Change-Id: I3be2fb95b623f7baba057a3936b6071fb82d6a15
This commit is contained in:
Abhishek Kekane 2016-05-25 11:45:23 +05:30
parent 8f5e65cae3
commit 27dbe1e746
1 changed files with 2 additions and 2 deletions

View File

@ -92,7 +92,7 @@ def is_valid_ipv4(address):
"""
try:
return netaddr.valid_ipv4(address)
except Exception:
except netaddr.AddrFormatError:
return False
@ -107,7 +107,7 @@ def is_valid_ipv6(address):
"""
try:
return netaddr.valid_ipv6(address)
except Exception:
except netaddr.AddrFormatError:
return False