Skip to content

Commit

Permalink
Only passthrough_errors if PROPAGATE_EXCEPTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Aug 27, 2016
1 parent 71e10be commit 098ea0c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion flask/app.py
Expand Up @@ -838,7 +838,8 @@ def run(self, host=None, port=None, debug=None, **options):
self.debug = bool(debug)
options.setdefault('use_reloader', self.debug)
options.setdefault('use_debugger', self.debug)
options.setdefault('passthrough_errors', True)
options.setdefault('passthrough_errors',
self.config['PROPAGATE_EXCEPTIONS'])
try:
run_simple(host, port, self, **options)
finally:
Expand Down
2 changes: 1 addition & 1 deletion flask/cli.py
Expand Up @@ -430,7 +430,7 @@ def run_command(info, host, port, reload, debugger, eager_loading,

run_simple(host, port, app, use_reloader=reload,
use_debugger=debugger, threaded=with_threads,
passthrough_errors=True)
passthrough_errors=app.config['PROPAGATE_EXCEPTIONS'])


@click.command('shell', short_help='Runs a shell in the app context.')
Expand Down
4 changes: 2 additions & 2 deletions tests/test_basic.py
Expand Up @@ -1268,8 +1268,8 @@ def run_simple_mock(*args, **kwargs):
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
app.config['PROPAGATE_EXCEPTIONS'] = propagate_exceptions
app.run(debug=debug, use_debugger=use_debugger, use_reloader=use_reloader)
# make sure werkzeug always passes errors through
assert rv['passthrough_errors']
# make sure werkzeug passes errors through if PROPAGATE_EXCEPTIONS
assert rv['passthrough_errors'] == propagate_exceptions


def test_max_content_length():
Expand Down

0 comments on commit 098ea0c

Please sign in to comment.