Issue #10129 has been updated by Yui NARUSE.


Nobuyoshi Nakada wrote:
> Shouldn't `Socket` methods raise more descriptive messages?
> 
> https://github.com/nobu/ruby/compare/socket-error-message

example domain should use *.invalid
http://tools.ietf.org/html/rfc2606

----------------------------------------
Feature #10129: More descriptive error message for failed net/http requests
https://bugs.ruby-lang.org/issues/10129#change-48360

* Author: Xavier Shay
* Status: Assigned
* Priority: Low
* Assignee: Akira Tanaka
* Category: ext
* Target version: current: 2.2.0
----------------------------------------
Hello,
I would like to propose the following patch:

Before

    2.1.2 :003 > Net::HTTP.get(URI.parse("https://arsrtrtrstsrt.com/arstr"))
    SocketError: getaddrinfo: nodename nor servname provided, or not known

After

    2.1.2 :003 > Net::HTTP.get(URI.parse("https://arsrtrtrstsrt.com/arstr"))
    SocketError: Failed to open TCP connection to arsrtrtrstsrt.com:443 (getaddrinfo: nodename nor servname provided, or not known)

I have an implementation with test at https://github.com/ruby/ruby/pull/700

Thank you for your consideration,
Xavier

---Files--------------------------------
net-http-error-message.diff (1.43 KB)


-- 
https://bugs.ruby-lang.org/