Open MarkReedZ opened 6 years ago
app.err404 was added so that a custom 404 can be displayed. However just directly returning it would return a 404 message with a 200 http response code. So to 404 I'm looking at these options. I can speed up the raise a bit, but it is still significantly slower than the second option as if you raise then the exception information has to be fetched before returning the 404.
raise mrhttp.NotFound
return r.NotFound()
Also the custom error pages could be specified by app.err[404] to allow for other codes. Perhaps the custom error page example should also show how to load an html file in case someone wants to do that.
Raising a 404 is a lot slower than a natural 404. I got this idea from sanic so suggest they change theirs as well.
I suggest app.err404 be the 404 page so it can just be returned. Performance would be equal to the hello world benchmark. The user can modify this page as well.