catch and prettify dns.exception.DNSException

closes #90
This commit is contained in:
jesopo 2019-07-09 12:18:34 +01:00
parent fc1ed92b4c
commit 51bed87b60

View file

@ -63,6 +63,10 @@ class Module(ModuleManager.BaseModule):
except dns.rdatatype.UnknownRdatatype:
raise utils.EventError("Unknown record type '%s'"
% record_type_strip)
except dns.exception.DNSException:
message = "Failed to get DNS records"
self.log.warn(message, exc_info=True)
raise utils.EventError(message)
results_str = ["%s: %s" % (t, ", ".join(r)) for t, r in results]
event["stdout"].write("(%s) %s" % (hostname, " | ".join(results_str)))