Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Passthrough exceptions in TESTING mode #146

Closed
wants to merge 1 commit into from

3 participants

@miracle2k

I think if TESTING is set, Flask should re-raise exceptions just like it currently does if DEBUG is enabled. This would enable a behavior similar to DEBUG_PROPAGATE_EXCEPTIONS while still testing with DEBUG=False.

@mitsuhiko
Owner

I would like to pull this but it might break people's code. Can you bring this up on the mailinglist?

@rduplain
Collaborator

This is implemented in 8569dfe -- please close.

@rcackerman rcackerman referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 21, 2010
  1. @miracle2k
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 5 deletions.
  1. +6 −5 flask/app.py
View
11 flask/app.py
@@ -673,16 +673,17 @@ def handle_http_exception(self, e):
def handle_exception(self, e):
"""Default exception handling that kicks in when an exception
- occours that is not catched. In debug mode the exception will
- be re-raised immediately, otherwise it is logged and the handler
- for a 500 internal server error is used. If no such handler
- exists, a default 500 internal server error message is displayed.
+ occours that is not catched. In debug or testing mode the
+ exception will be re-raised immediately, otherwise it is logged
+ and the handler for a 500 internal server error is used.
+ If no such handler exists, a default 500 internal server error
+ message is displayed.
.. versionadded: 0.3
"""
got_request_exception.send(self, exception=e)
handler = self.error_handlers.get(500)
- if self.debug:
+ if self.debug or self.testing:
raise
self.logger.exception('Exception on %s [%s]' % (
request.path,
Something went wrong with that request. Please try again.