ruby-amqp/bunny — pull request #98 by hkarthik (2013-02-12 04:42:11+00:00)
Title: Base Error class for all Bunny Exceptions?

I notice that there are a number of Error classes defined here:
https://github.com/ruby-amqp/bunny/blob/master/lib/bunny/exceptions.rb

Would it make sense to have them all inherit from one base BunnyException? This would make it easier to rescue specific Bunny exceptions in client code without having to rescue them one by one.

Right now I'm forced to do this and maintain the list in my client code:
```ruby```
BUNNY_EXCEPTIONS = [Bunny::TCPConnectionFailed, Bunny::ConnectionClosedError,
Bunny::PossibleAuthenticationError,
Bunny::ForcedChannelCloseError, Bunny::ForcedConnectionCloseError,
Bunny::MessageError, Bunny::ProtocolError,
Bunny::InconsistentDataError, Bunny::ChannelLevelException,
Bunny::ConnectionLevelException, Bunny::NetworkErrorWrapper
begin
# some bunny code
rescue *BUNNY_EXCEPTIONS => e
# handle bunny exceptions
rescue = > e
# handle all other exceptions
end
```

If it makes sense to do this, I'd be glad to submit a patch. Otherwise if anyone has any suggestions please let me know!

Thanks,
Karthik Hariharan
Desk.com