Skip to content

Commit

Permalink
catch EOFError exception, add note about readable exception messages …
Browse files Browse the repository at this point in the history
…PR, fixes #197
  • Loading branch information
ThomasWaldmann committed Jan 26, 2015
1 parent f6f98e7 commit 0c95fba
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nsupdate/main/dnstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,15 @@ def update_ns(fqdn, rdtype='A', ipaddr=None, action='upd', ttl=60):
rcode_text, action, name, origin, rdtype, ipaddr))
raise DnsUpdateError(rcode_text)
return response
# TODO simplify exception handling when https://github.com/rthalley/dnspython/pull/85 is merged/released
except socket.error as e:
logger.error("socket.error [%s] - zone: %s" % (str(e), origin, ))
set_ns_availability(domain, False)
raise DnsUpdateError("SocketError %d" % e.errno)
except EOFError as e:
logger.error("EOFError [%s] - zone: %s" % (str(e), origin, ))
set_ns_availability(domain, False)
raise DnsUpdateError("EOFError")
except dns.exception.Timeout:
logger.warning("timeout when performing %s for name %s and origin %s with rdtype %s and ipaddr %s" % (
action, name, origin, rdtype, ipaddr))
Expand Down

0 comments on commit 0c95fba

Please sign in to comment.