Improved error handling.

This commit is contained in:
Martin Edenhofer 2014-12-09 11:31:50 +01:00
parent 9d53f977e5
commit f57383436f

View file

@ -846,9 +846,14 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
end
def mxers(domain)
mxs = Resolv::DNS.open do |dns|
ress = dns.getresources(domain, Resolv::DNS::Resource::IN::MX)
ress.map { |r| [r.exchange.to_s, IPSocket::getaddress(r.exchange.to_s), r.preference] }
begin
mxs = Resolv::DNS.open do |dns|
ress = dns.getresources(domain, Resolv::DNS::Resource::IN::MX)
ress.map { |r| [r.exchange.to_s, IPSocket::getaddress(r.exchange.to_s), r.preference] }
end
rescue Exception => e
logger.error e.message
logger.error e.backtrace.inspect
end
mxs
end