From: Ben Darnell Date: Tue, 28 Dec 2010 02:30:21 +0000 (-0800) Subject: Fix stack trace logging for uncaught RequestHandler exceptions. X-Git-Tag: v1.2.0~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f63525f7a44d7b5d12c327d1173f2c2680d56757;p=thirdparty%2Ftornado.git Fix stack trace logging for uncaught RequestHandler exceptions. _handle_request_exception is a private method, but since I've endorsed overriding it on the mailing list preserve backwards compatibility by re-raising the exception so it appears in sys.exc_info(). Closes #199. --- diff --git a/tornado/web.py b/tornado/web.py index 70bd01136..d9e3c7e06 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -810,7 +810,14 @@ class RequestHandler(object): return self.application.reverse_url(name, *args) def _stack_context_handle_exception(self, type, value, traceback): - self._handle_request_exception(value) + try: + # For historical reasons _handle_request_exception only takes + # the exception value instead of the full triple, + # so re-raise the exception to ensure that it's in + # sys.exc_info() + raise type, value, traceback + except: + self._handle_request_exception(value) return True def _execute(self, transforms, *args, **kwargs):