Skip to content
Myr

Merge pull request #3498 from raymond-devries/3445-traceback-for-none

Before adoption: this commit came in with the history the project adopted, so no landing records it.

View returned none exception contains endpoint name

authored by David Lord · committed by GitHub · parents 5ceb0a5, 900fa2f · Browse files · 2 files+3 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+3 added−2 removed

  • tests:+1 added−0 removed
  • other:+2 added−2 removed

2 files+3 added−2 removed

modified:src/flask/app.py+2 added-2 removed
2076 unmodified lines
20772078 # the body must not be None2079 if rv is None:2080 raise TypeError(2081 "The view function did not return a valid response. The"2081 'The view function for "{}" did not return a valid response. The'2082 " function either returned None or ended without a return"2083 " statement."2083 " statement.".format(request.endpoint)2084 )20852086 # make sure the body is an instance of the response class2087 if not isinstance(rv, self.response_class):
363 unmodified lines
modified:tests/test_basic.py+1 added
1219 unmodified lines
12201221 with pytest.raises(TypeError) as e:1222 c.get("/none")1223 assert "returned None" in str(e.value)1224 assert "from_none" in str(e.value)12251226 with pytest.raises(TypeError) as e:1227 c.get("/small_tuple")1228 assert "tuple must have the form" in str(e.value)
740 unmodified lines