adhearsion/punchblock — Issue #88: Punchblock::ProtocolError destroys valuable backtrace information
Author: bklang
Created: 2012-02-16 21:03:27+00:00
State: open

See https://github.com/adhearsion/punchblock/blob/develop/lib/punchblock/connection/xmpp.rb#L85

When using adhearsion/adhearsion-xmpp, message handlers run within the context of the Punchblock Connection. This means that any exceptions happening in user code get raised, converted to Punchblock::ProtocolError, and then re-raised. Example:

```
[2012-02-16 15:53:36] ERROR Adhearsion::Initializer: #
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/gems/punchblock-0.9.1/lib/punchblock/connection/xmpp.rb:85:in `rescue in connect'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/gems/punchblock-0.9.1/lib/punchblock/connection/xmpp.rb:77:in `connect'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/gems/punchblock-0.9.1/lib/punchblock/connection/xmpp.rb:73:in `run'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/gems/punchblock-0.9.1/lib/punchblock/client.rb:11:in `run'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/bundler/gems/adhearsion-89f17d4771c3/lib/adhearsion/punchblock_plugin/initializer.rb:99:in `connect_to_server'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/bundler/gems/adhearsion-89f17d4771c3/lib/adhearsion/punchblock_plugin/initializer.rb:89:in `block (2 levels) in connect'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/bundler/gems/adhearsion-89f17d4771c3/lib/adhearsion/foundation/exception_handler.rb:4:in `catching_standard_errors'
/srv/apps/arabbit.mojolingo.com/shared/bundle/ruby/1.9.1/bundler/gems/adhearsion-89f17d4771c3/lib/adhearsion/punchblock_plugin/initializer.rb:89:in `block in connect'
```

The only clue as to the actual problem here is the message itself: "can't convert String into Integer", but the backtrace is meaningless because the original exception happened somewhere else.