Issue
As the title asked: Is the RequestHandler.on_finish() method guaranteed to be called? Even if, say, the .post() method had an unhandled Exception?
Solution
Yes, on_finish is always called even when an unhandled exception occurs.
Tornado runs the handler method within a try...except block. So when there's an unhandled exception, Tornado generates a 500 error response and calls the finish() method to close the request which in turn calls the on_finish() method.
Answered By - xyres Answer Checked By - Pedro (Python.Easybugfix Volunteer)
Post a Comment
Post a Comment