123456789_123456789_123456789_123456789_123456789_

Exception: Socket::ResolutionError

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ::SocketError, ::StandardError, Exception
Instance Chain:
self, ::SocketError, ::StandardError, Exception
Inherits: SocketError
Defined in: ext/socket/init.c

Overview

ResolutionError is the error class for hostname resolution.

Instance Method Summary

Instance Method Details

#error_codeInteger

Returns the raw error code indicating the cause of the hostname resolution failure.

begin
  Addrinfo.getaddrinfo("ruby-lang.org", nil)
rescue Socket::ResolutionError => e
  if e.error_code == Socket::EAI_AGAIN
    puts "Temporary failure in name resolution."
  end
end

Note that error codes depend on the operating system.

[ GitHub ]

  
# File 'ext/socket/init.c', line 801

static VALUE
sock_resolv_error_code(VALUE self)
{
    return rb_attr_get(self, id_error_code);
}