Skip to content

Instantly share code, notes, and snippets.

@nbarrientos
Created March 13, 2018 14:01
Show Gist options
  • Save nbarrientos/a3c6b49c0c30c30bdf056ac8dbb811fb to your computer and use it in GitHub Desktop.
Save nbarrientos/a3c6b49c0c30c30bdf056ac8dbb811fb to your computer and use it in GitHub Desktop.
begin
puts resolver.getaddress('foo.example.org')
rescue Exception => e
puts e.class
puts e.message
end
# DNS server not available
$ ruby foo.rb
Resolv::ResolvError
DNS result has no information for foo.example.org
# DNS server available but no record for foo.example.org
$ ruby foo.rb
Resolv::ResolvError
DNS result has no information for foo.example.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment