From f57383436f4c0cfa2d11363519e284eb0b6d0836 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 9 Dec 2014 11:31:50 +0100 Subject: [PATCH] Improved error handling. --- app/controllers/getting_started_controller.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index 96cd7e185..9f7f0f96f 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -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