Reputation: 2512
I want to do some custom logging with Tornado.
When I throw a tornado.web.HTTPError with an error message, is there a way for me to retrieve the message for my request handler's on_finish() method? If not, how can I log it?
Thanks in advance.
Upvotes: 0
Views: 391
Reputation: 12054
It is possible to override RequestHandler's write_error
method:
RequestHandler.write_error(status_code, **kwargs)
You can process the exception there: log it or show custom page. The details of exception are kept in kwargs["exc_info"]
.
Upvotes: 1