Improved error handling.
This commit is contained in:
parent
9d53f977e5
commit
f57383436f
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue