Created
May 31, 2011 07:28
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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