Skip to content

Commit 78a71a4

Browse files
authored
Merge pull request pallets#1996 from untitaker/propagate-exceptions-werkzeug
Only passthrough_errors if PROPAGATE_EXCEPTIONS
2 parents 71e10be + 098ea0c commit 78a71a4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

flask/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,8 @@ def run(self, host=None, port=None, debug=None, **options):
838838
self.debug = bool(debug)
839839
options.setdefault('use_reloader', self.debug)
840840
options.setdefault('use_debugger', self.debug)
841-
options.setdefault('passthrough_errors', True)
841+
options.setdefault('passthrough_errors',
842+
self.config['PROPAGATE_EXCEPTIONS'])
842843
try:
843844
run_simple(host, port, self, **options)
844845
finally:

flask/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def run_command(info, host, port, reload, debugger, eager_loading,
430430

431431
run_simple(host, port, app, use_reloader=reload,
432432
use_debugger=debugger, threaded=with_threads,
433-
passthrough_errors=True)
433+
passthrough_errors=app.config['PROPAGATE_EXCEPTIONS'])
434434

435435

436436
@click.command('shell', short_help='Runs a shell in the app context.')

tests/test_basic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,8 +1268,8 @@ def run_simple_mock(*args, **kwargs):
12681268
monkeypatch.setattr(werkzeug.serving, 'run_simple', run_simple_mock)
12691269
app.config['PROPAGATE_EXCEPTIONS'] = propagate_exceptions
12701270
app.run(debug=debug, use_debugger=use_debugger, use_reloader=use_reloader)
1271-
# make sure werkzeug always passes errors through
1272-
assert rv['passthrough_errors']
1271+
# make sure werkzeug passes errors through if PROPAGATE_EXCEPTIONS
1272+
assert rv['passthrough_errors'] == propagate_exceptions
12731273

12741274

12751275
def test_max_content_length():

0 commit comments

Comments
 (0)