Make sure that a faulty api call end after error

This commit is contained in:
Ruud
2013-09-04 13:46:51 +02:00
parent 7f304b0c28
commit ec302fe665

View File

@@ -95,8 +95,12 @@ class ApiHandler(RequestHandler):
# Add async callback handler
@run_async
def run_handler(callback):
result = api[route](**kwargs)
callback(result)
try:
result = api[route](**kwargs)
callback(result)
except:
log.error('Failed doing api request "%s": %s', (route, traceback.format_exc()))
callback({'success': False, 'error': 'Failed returning results'})
result = yield tornado.gen.Task(run_handler)
# Check JSONP callback