facebook/tornado — pull request #652 by rhettg (2012-12-08 00:21:20+00:00)
Title: http client hides exceptions generated in callbacks

If an exception is generated in a callback (or callback chain) from the http client, the exception is caught by the `cleanup()` method which logs the exception, wraps it in an `HTTPResponse` and tries to pass it to the callback again. SInce the callback is already called, this is a no-op.

The consequence of this handling is that it's very difficult to get at unhandled errors.

In most cases, you can sub-class IOLoop by redefining `handle_callback_exception()` to have your own customized behavior for unhandled exceptions.

This patch keeps the existing behavior for exceptions generated before the callback, but re-raises exceptions after or during the callback, allowing `handle_callback_exception()` to deal with ALL unhandled exceptions.