github/hubot — pull request #748 by technicalpickles (2014-08-22 02:11:43+00:00)
Title: Fix error logging

I don't have a particular issue handy, but I have seen reports of hubot scripts not working but also not logging anything useful. I never was able to reproduce hubot not logging messages, but I finally figured out why.

hubot adds a `process.on 'uncaughtException'` handler, and calls `invokeErrorHandlers`. This goes through all the error handlers configured with `robot.error` and invokes them in turn.

The production hubot I normally test against has it's own error handler, so I wasn't able to spot it there. And it turns out the shell adapter has it's own `process.on 'uncaughtException'` handler, so whenever I did testing, it was getting displayed using that, rather than the builtin one :sweat:

This seems to work so far with the shell adapter, but definitely need to test with campfire and other adapters to confirm, which is a bit more work.

As part of this, I added a `scripts/boomtown.coffee` for testing. If you do `bin/hubot`, it'll load the scripts you get with new bots (ie `src/scripts`, and also these new ones. I intend this `scripts` directory to be for testing hubot itself.