From 9a2f8a3e4f5ea80ba0e6c497acfc8bee40a04375 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 20 Dec 2014 21:32:08 +0100 Subject: [PATCH] http: Log errors instead of dying for HTTP startup. --- docs/changelog.rst | 5 +++++ mopidy/http/actor.py | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index a0371840..36b81f25 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -69,6 +69,11 @@ v0.20.0 (UNRELEASED) make sense for a server such as Mopidy. Currently the only way to find out if it is in use and will be missed is to go ahead and remove it. +**HTTP** + +- Log error while starting HTTP apps instead letting the HTTP server thread + die. (Fixes: :issue:`875`) + v0.19.5 (UNRELEASED) ==================== diff --git a/mopidy/http/actor.py b/mopidy/http/actor.py index d37a5672..200ef833 100644 --- a/mopidy/http/actor.py +++ b/mopidy/http/actor.py @@ -129,11 +129,16 @@ class HttpServer(threading.Thread): def _get_app_request_handlers(self): result = [] for app in self.apps: + try: + request_handlers = app['factory'](self.config, self.core) + except Exception: + logger.exception('Loading %s failed.', app['name']) + continue + result.append(( r'/%s' % app['name'], handlers.AddSlashHandler )) - request_handlers = app['factory'](self.config, self.core) for handler in request_handlers: handler = list(handler) handler[0] = '/%s%s' % (app['name'], handler[0])