Hi!
I have something like this:
require 'net/http'
begin
site = Net::HTTP.new('somedomain.com', 80)
site.get('/')
rescue Exception => e
puts "#{e.class}: #{e}"
end
Now, from my tests, if 'somedomain.com' does not exist OR there is no internet connectivity I get a "SocketError: getaddrinfo: No such host is known".
My question for Ruby gurus is: what ways/methods/techniques (other then pinging google, yahoo, etc) exists to check if SocketErorr was raised by a non-existent host or because Internet Connection was lost?