diff --git a/nsupdate/main/dnstools.py b/nsupdate/main/dnstools.py index 69a3496..ce30430 100644 --- a/nsupdate/main/dnstools.py +++ b/nsupdate/main/dnstools.py @@ -64,6 +64,7 @@ class FQDN(namedtuple('FQDN', ['host', 'domain'])): Timeout = dns.resolver.Timeout NoNameservers = dns.resolver.NoNameservers +DNSException = dns.exception.DNSException class SameIpError(ValueError): diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index ebed81b..b9d37f2 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -238,6 +238,8 @@ class AddHostView(CreateView): success, level, msg = False, messages.ERROR, 'Base domain does not exist.' except dnstools.SameIpError: success, level, msg = False, messages.ERROR, 'Host already exists in DNS.' + except dnstools.DNSException as e: + success, level, msg = False, messages.ERROR, 'DNSException [%s]' % str(e) except socket.error as err: success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err) else: