You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've made a Python API file for fetching a resource. If the resource doesn't exist, I want to return "404 Not Found". I have tried Flask's abort(404), but the NotFound error is caught at some point and I get a TypeError instead, resulting in a 500 Server Error from Zero. Here is the stack trace:
werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
[2020-06-05 20:40:01,549] ERROR in app: Exception on /video/foobar/ [GET]
Traceback (most recent call last):
File "/home/tomas/.local/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
response = self.full_dispatch_request()
File "/home/tomas/.local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
return self.finalize_request(rv)
File "/home/tomas/.local/lib/python3.8/site-packages/flask/app.py", line 1967, in finalize_request
response = self.make_response(rv)
File "/home/tomas/.local/lib/python3.8/site-packages/flask/app.py", line 2096, in make_response
raise TypeError(
TypeError: The view function did not return a valid response. The function either returned None or ended without a return statement.
Is this a bug? Or is there a different way to do it?
The text was updated successfully, but these errors were encountered:
I've made a Python API file for fetching a resource. If the resource doesn't exist, I want to return "404 Not Found". I have tried Flask's
abort(404)
, but the NotFound error is caught at some point and I get a TypeError instead, resulting in a 500 Server Error from Zero. Here is the stack trace:Is this a bug? Or is there a different way to do it?
The text was updated successfully, but these errors were encountered: