So I am scheduling a callback using
ioloop.IOLoop.instance().add_timeout(time, callback_func)
But my callback_func
may throw Exception
which I want to catch.
Tried whats suggested in this answer but doesn't seem to work. Or maybe I am not doing it the right way. Any help on this would be great.
Code is somewhat like this:
start.py
class Start:
# ... other methods ...
@staticmethod
def initialize():
OtherClass.initialize()
def main():
Start.initialize()
if __name__ == "__main__":
main()
ioloop.IOLoop.instance().start()
other_class.py
class OtherClass:
@staticmethod
def initialize():
ioloop.IOLoop.instance().add_timeout(time, callback_func)
@staticmethod
def callback_func():
# Need to catch any exception which occurs here.