github/hubot — pull request #627 by technicalpickles (2013-12-31 23:00:30+00:00)
Title: Emit `msg` whenever possible along with `err`

Error handlers get passed the received error and a `msg` object. They can check if `msg` is defined, and `msg.reply` to the user with whta happened and where to get more info.

The problem is that hubot script writers need to explicitly catch and emit the error, along with the `msg`, which ends up being a bit boilerplatey. There's not much hubot core can do (yet) for asynchronous code, but we already `try/catch` when invoking listners, and emit 'error'. This PR updates that logic to also build a `msg` (which is actually a Repsonse) along with it, so any synchronous code in the listeners will have the extra context of the `msg`.