lib/woodhouse/dispatchers/bunny_dispatcher.rb in woodhouse-0.1.5 vs lib/woodhouse/dispatchers/bunny_dispatcher.rb in woodhouse-1.0.0
- old
+ new
@@ -18,13 +18,13 @@
def run
retried = false
@pool.with do |conn|
yield conn
end
- rescue Bunny::ClientTimeout
+ rescue Bunny::ClientTimeout => err
if retried
- raise
+ raise Woodhouse::ConnectionError, "timed out while contacting AMQP server: #{err.message}"
else
new_pool!
retried = true
retry
end
@@ -41,8 +41,10 @@
bunny = @bunny = Bunny.new(@config.server_info || {})
@bunny.start
ConnectionPool.new { bunny.create_channel }
+ rescue Bunny::TCPConnectionFailed => err
+ raise Woodhouse::ConnectionError, "unable to connect to AMQP server: #{err.message}"
end
end