From ec302fe66553b4186263f331b47da361e9bc223c Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 4 Sep 2013 13:46:51 +0200 Subject: [PATCH] Make sure that a faulty api call end after error --- couchpotato/api.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/couchpotato/api.py b/couchpotato/api.py index e78f0f2d..a9f449be 100644 --- a/couchpotato/api.py +++ b/couchpotato/api.py @@ -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