From 94bdb88b9cb161dd9736c74c1804c03246d235a3 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. (cherry picked from commit 9a2f8a3e4f5ea80ba0e6c497acfc8bee40a04375) Conflicts: docs/changelog.rst --- docs/changelog.rst | 3 +++ mopidy/http/actor.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 979a5a0c..ba00ed1f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -29,6 +29,9 @@ Bug fix release. - MPD: Remove track comments from responses. They are not included by the original MPD server, and this works around :issue:`881`. (PR: :issue:`882`) +- HTTP: Errors while starting HTTP apps are logged instead of crashing the HTTP + server. (Fixes: :issue:`875`) + v0.19.4 (2014-09-01) ==================== diff --git a/mopidy/http/actor.py b/mopidy/http/actor.py index 57e2f46a..a61fc45c 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])