Call handle_callback_exception() with the callback as argument
instead of hardcoding the call to logging.debug(). This way, users
can add their own exception handling code by subclassing
AsyncHTTPClient.
Default implementation for handle_callback_exception() calls that
same function on the IOLoop associated to this AsyncHTTPClient
instance, so users can handle any exceptions raised from their
callbacks just by overriding handle_callback_exception() in IOLoop.
except (KeyboardInterrupt, SystemExit):
raise
except:
- logging.error("Exception in callback %r", info["callback"],
- exc_info=True)
+ self.handle_callback_exception(info["callback"])
+
+
+ def handle_callback_exception(self, callback):
+ self.io_loop.handle_callback_exception(callback)
# For backwards compatibility: Tornado 1.0 included a new implementation of
# AsyncHTTPClient that has since replaced the original. Define an alias