diff --git a/lib/bunny/transport.rb b/lib/bunny/transport.rb index 442843f28..81b26dd84 100644 --- a/lib/bunny/transport.rb +++ b/lib/bunny/transport.rb @@ -71,7 +71,14 @@ def write(*args) end rescue Errno::EPIPE, Errno::EAGAIN, Bunny::ClientTimeout, IOError => e close - raise Bunny::ConnectionError.new(e.message, @host, @port) + + m = case e + when String then + e + when Exception then + e.message + end + raise Bunny::ConnectionError.new(m, @host, @port) end end alias send_raw write