! A proper fix for the error I've found yesterday.

We should further look for empty rescue statements, as they may
sometimes catch stuff that we don't want to be caught.
This commit is contained in:
Kaspar Schiess 2010-03-18 08:44:58 +01:00
parent 6a17e6a2c2
commit 31ba47cf1d
3 changed files with 54 additions and 3 deletions

View file

@ -1,6 +1,5 @@
require 'openssl'
require 'ostruct'
require 'socket'
require 'net/ber'
@ -1122,8 +1121,10 @@ module Net
def initialize server
begin
@conn = TCPSocket.new( server[:host], server[:port] )
rescue
raise LdapError.new( "no connection to server" )
rescue SocketError
raise LdapError, "No such address or other socket error."
rescue Errno::ECONNREFUSED
raise LdapError, "Server #{server[:host]} refused connection on port #{server[:port]}."
end
if server[:encryption]