trap key errors in debug, not all 400 errors
This commit is contained in:
parent
5239458f28
commit
b573a86977
2 changed files with 27 additions and 8 deletions
10
flask/app.py
10
flask/app.py
|
|
@ -1663,8 +1663,14 @@ class Flask(_PackageBoundObject):
|
|||
|
||||
trap_bad_request = self.config['TRAP_BAD_REQUEST_ERRORS']
|
||||
|
||||
# if unset, trap based on debug mode
|
||||
if (trap_bad_request is None and self.debug) or trap_bad_request:
|
||||
# if unset, trap key errors in debug mode
|
||||
if (
|
||||
trap_bad_request is None and self.debug
|
||||
and isinstance(e, BadRequestKeyError)
|
||||
):
|
||||
return True
|
||||
|
||||
if trap_bad_request:
|
||||
return isinstance(e, BadRequest)
|
||||
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue