facebook/tornado — pull request #411 by kachayev (2011-12-05 21:53:03+00:00)
Title: Exceptions processing in gen.Task

It solves this issue:
https://github.com/facebook/tornado/issues/405

So this code:

from tornado import ioloop
from tornado import gen
io_loop = ioloop.IOLoop.instance()

def async_func(callback):
10/0
io_loop.add_callback(lambda: callback(100))

@gen.engine
def main():
try:
num = yield gen.Task(async_func)
except Exception as e:
print 'Here our exception:', str(e)
else:
print num
finally:
io_loop.stop()

if __name__=='__main__':
main()
io_loop.start()

will have next output:

Here our exception: integer division or modulo by zero