use exception chaining

fixes flake8-bugbear B904
This commit is contained in:
David Lord 2021-10-01 09:39:10 -07:00
parent ca0033c11a
commit 6a4bf9eec1
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
5 changed files with 21 additions and 20 deletions

View file

@ -1621,7 +1621,7 @@ class Flask(Scaffold):
except ImportError:
raise RuntimeError(
"Install Flask with the 'async' extra in order to use async views."
)
) from None
# Check that Werkzeug isn't using its fallback ContextVar class.
if ContextVar.__module__ == "werkzeug.local":
@ -1727,7 +1727,7 @@ class Flask(Scaffold):
" response. The return type must be a string,"
" dict, tuple, Response instance, or WSGI"
f" callable, but it was a {type(rv).__name__}."
).with_traceback(sys.exc_info()[2])
).with_traceback(sys.exc_info()[2]) from None
else:
raise TypeError(
"The view function did not return a valid"