From 75e890bbd1e9bc5a6aba360d9660c9eda4cddcd1 Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Tue, 11 Jul 2017 12:37:20 +0300 Subject: Updated to log the exact DNS error. This is part of #13. --- lib/custodian/protocoltest/http.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/custodian/protocoltest/http.rb') diff --git a/lib/custodian/protocoltest/http.rb b/lib/custodian/protocoltest/http.rb index dfd8ee4..67b4660 100644 --- a/lib/custodian/protocoltest/http.rb +++ b/lib/custodian/protocoltest/http.rb @@ -336,9 +336,9 @@ module Custodian errors << "#{protocol_msg}: Connection failed." rescue Curl::Err::TooManyRedirectsError errors << "#{protocol_msg}: More than 10 redirections." - rescue Curl::Err::HostResolutionError - # Nothing to see here..! - resolution_errors << resolve_mode + rescue Curl::Err::HostResolutionError => x + # Log the DNS error-message. + resolution_errors << "#{resolve_mode} - #{x.message}" rescue => x errors << "#{protocol_msg}: #{x.class}: #{x.message}\n #{x.backtrace.join("\n ")}." end @@ -359,8 +359,8 @@ module Custodian end # uh-oh! Resolution failed on both protocols! - if resolution_errors.length > 1 - errors << "Hostname did not resolve for #{resolution_errors.join(', ')}" + if resolution_errors.length > 0 + errors << "DNS Error when resolving host - #{resolution_errors.join(',')}" end if !errors.empty? -- cgit v1.2.1