forked from orbit-oss/flask
Merge pull request #3498 from raymond-devries/3445-traceback-for-none
View returned none exception contains endpoint name
This commit is contained in:
commit
a3e4395a42
2 changed files with 3 additions and 2 deletions
|
|
@ -2078,9 +2078,9 @@ class Flask(_PackageBoundObject):
|
||||||
# the body must not be None
|
# the body must not be None
|
||||||
if rv is None:
|
if rv is None:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
"The view function did not return a valid response. The"
|
'The view function for "{}" did not return a valid response. The'
|
||||||
" function either returned None or ended without a return"
|
" function either returned None or ended without a return"
|
||||||
" statement."
|
" statement.".format(request.endpoint)
|
||||||
)
|
)
|
||||||
|
|
||||||
# make sure the body is an instance of the response class
|
# make sure the body is an instance of the response class
|
||||||
|
|
|
||||||
|
|
@ -1221,6 +1221,7 @@ def test_response_type_errors():
|
||||||
with pytest.raises(TypeError) as e:
|
with pytest.raises(TypeError) as e:
|
||||||
c.get("/none")
|
c.get("/none")
|
||||||
assert "returned None" in str(e.value)
|
assert "returned None" in str(e.value)
|
||||||
|
assert "from_none" in str(e.value)
|
||||||
|
|
||||||
with pytest.raises(TypeError) as e:
|
with pytest.raises(TypeError) as e:
|
||||||
c.get("/small_tuple")
|
c.get("/small_tuple")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue