set description for trap as well as debug

test for key error description
This commit is contained in:
David Lord 2017-05-29 19:41:07 -07:00
parent 045dccaefb
commit 42905b8a55
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
2 changed files with 8 additions and 3 deletions

View file

@ -1583,9 +1583,9 @@ class Flask(_PackageBoundObject):
# MultiDict passes the key to the exception, but that's ignored
# when generating the response message. Set an informative
# description for key errors in debug mode.
# description for key errors in debug mode or when trapping errors.
if (
self.debug
self.debug or self.config['TRAP_BAD_REQUEST_ERRORS']
and isinstance(e, BadRequestKeyError)
# only set it if it's still the default description
and e.description is BadRequestKeyError.description