Exception: Bunny::TCPConnectionFailed

Inherits:
Exception
  • Object
show all
Defined in:
lib/bunny/exceptions.rb

Overview

Raised when TCP connection to RabbitMQ fails because of an unresolved hostname, connectivity problem, etc

Direct Known Subclasses

TCPConnectionFailedForAllHosts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(e, hostname = nil, port = nil) ⇒ TCPConnectionFailed

Returns a new instance of TCPConnectionFailed



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/bunny/exceptions.rb', line 68

def initialize(e, hostname=nil, port=nil)
  m = case e
      when String then
        e
      when ::Exception then
        e.message
      end
  if hostname && port
    super("Could not establish TCP connection to #{hostname}:#{port}: #{m}")
  else
    super(m)
  end
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname



66
67
68
# File 'lib/bunny/exceptions.rb', line 66

def hostname
  @hostname
end

#portObject (readonly)

Returns the value of attribute port



66
67
68
# File 'lib/bunny/exceptions.rb', line 66

def port
  @port
end