examples/connection/unknown_host.rb in bunny-0.9.0.pre5 vs examples/connection/unknown_host.rb in bunny-0.9.0.pre6
- old
+ new
@@ -6,8 +6,11 @@
$:.unshift(File.expand_path("../../../lib", __FILE__))
require 'bunny'
-conn = Bunny.new("amqp://guest:guest@aksjhdkajshdkj.example82737.com")
-conn.start
-
+begin
+ conn = Bunny.new("amqp://guest:guest@aksjhdkajshdkj.example82737.com")
+ conn.start
+rescue Bunny::TCPConnectionFailed => e
+ puts "Connection to #{conn.hostname} failed"
+end