Also passthrough errors when TESTING is set.

This commit is contained in:
Michael Elsdoerfer 2010-11-22 00:13:01 +01:00
parent ed517c7215
commit a1354601c3

View file

@ -673,16 +673,17 @@ class Flask(_PackageBoundObject):
def handle_exception(self, e): def handle_exception(self, e):
"""Default exception handling that kicks in when an exception """Default exception handling that kicks in when an exception
occours that is not catched. In debug mode the exception will occours that is not catched. In debug or testing mode the
be re-raised immediately, otherwise it is logged and the handler exception will be re-raised immediately, otherwise it is logged
for a 500 internal server error is used. If no such handler and the handler for a 500 internal server error is used.
exists, a default 500 internal server error message is displayed. If no such handler exists, a default 500 internal server error
message is displayed.
.. versionadded: 0.3 .. versionadded: 0.3
""" """
got_request_exception.send(self, exception=e) got_request_exception.send(self, exception=e)
handler = self.error_handlers.get(500) handler = self.error_handlers.get(500)
if self.debug: if self.debug or self.testing:
raise raise
self.logger.exception('Exception on %s [%s]' % ( self.logger.exception('Exception on %s [%s]' % (
request.path, request.path,