Skip to content

Instantly share code, notes, and snippets.

@williame
Created May 31, 2011 07:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williame/1000106 to your computer and use it in GitHub Desktop.
Save williame/1000106 to your computer and use it in GitHub Desktop.
For me at least, raising an exception in a callback does not do anything to the request
from tornado import ioloop, web, httpserver, httpclient
PORT = 8080
class TestHandler(web.RequestHandler):
@web.asynchronous
def get(self):
url = "http://www.google.com"
print "fetching",url
http = httpclient.AsyncHTTPClient()
http.fetch(url,callback=self._test)
def _test(self,response):
print "Uploaded: now fail"
raise web.HTTPError(500)
if __name__ == "__main__":
print "Testing error handling of async tornado on port",PORT
server = httpserver.HTTPServer(web.Application((
(r"/",TestHandler),
)))
server.listen(PORT)
_ioloop = ioloop.IOLoop.instance()
_ioloop.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment