Exception: Net::LDAP::ConnectionError

Inherits:
Error
  • Object
show all
Defined in:
lib/net/ldap/error.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ ConnectionError

Returns a new instance of ConnectionError.


18
19
20
21
# File 'lib/net/ldap/error.rb', line 18

def initialize(errors)
  message = "Unable to connect to any given server: \n  #{errors.map { |e, h, p| "#{e.class}: #{e.message} (#{h}:#{p})" }.join("\n  ")}"
  super(message)
end

Class Method Details

.new(errors) ⇒ Object


7
8
9
10
11
12
13
14
15
16
# File 'lib/net/ldap/error.rb', line 7

def self.new(errors)
  error = errors.first.first
  if errors.size == 1
    return error if error.is_a? Errno::ECONNREFUSED

    return Net::LDAP::Error.new(error.message)
  end

  super
end