title: Exception handling in Python Tornado
body: <p>I am trying to handle exception occurred in <code>AsyncClient.fetch</code> in this way:</p>
  
  <pre><code>
  from tornado.httpclient import AsyncHTTPClient
  from tornado.httpclient import HTTPRequest
  from tornado.stack_context import ExceptionStackContext
  from tornado import ioloop
  
  def handle_exc(*args):
      print('Exception occured')
      return True
  
  def handle_request(response):
      print('Handle request')
  
  http_client = AsyncHTTPClient()
  
  with ExceptionStackContext(handle_exc):
      http_client.fetch('http://some123site.com', handle_request)
  
  ioloop.IOLoop.instance().start()
  
  </code></pre>
  
  <p>and see next output:</p>
  
  <pre><code>
  WARNING:root:uncaught exception
  Traceback (most recent call last):
    File "/home/crchemist/python-3.2/lib/python3.2/site-packages/tornado-2.0-py3.2.egg/tornado/simple_httpclient.py", line 259, in cleanup
      yield
    File "/home/crchemist/python-3.2/lib/python3.2/site-packages/tornado-2.0-py3.2.egg/tornado/simple_httpclient.py", line 162, in __init__
      0, 0)
  socket.gaierror: [Errno -5] No address associated with hostname
  Handle request
  
  </code></pre>
  
  <p>What am I doing wrong?</p>