facebook/tornado — Issue #405: Can't catch error in gen.Task
Author: perol
Created: 2011-11-29 03:52:29+00:00
State: open

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

def async_func(callback):
#callback(100)
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 e
else:
print num
finally:
io_loop.stop()

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

I expect print error, but it exit because the error can't been caught when using gen.Task