ruby-net-ldap icon indicating copy to clipboard operation
ruby-net-ldap copied to clipboard

DNS lookup error: message should perhaps include host and port

Open perlun opened this issue 8 years ago • 1 comments

If an invalid DNS name is used, this is the e.message that gets raised:

ERROR [2017-04-20 12:52:05.397] ConsoleLogger: Error message: getaddrinfo: name or service not known

As can be seen in this code, the host and port gets included here, but not in the message: https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ldap/connection.rb#L68

Is this by design? It makes the code using the gem a bit harder; we cannot just use the exception text and log it right away (like above), but we would need to special-case exceptions caused by this gem specifically and log the extra data.

Thanks for a great gem! 😄

perlun avatar Apr 20 '17 09:04 perlun

I looked a bit more: the Net::LDAP::Error class does not contain this info at all, which is a bit unfortunate: https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ldap/error.rb

(This is running on JRuby 9.1.8.0, on macOS Sierra.)

perlun avatar Apr 20 '17 11:04 perlun