From 2d952570d0085013dd79f577b669f70f6f3d86bc Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Tue, 12 May 2015 00:06:31 +0200 Subject: [PATCH] main: Catch extension.setup exceptions --- mopidy/__main__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mopidy/__main__.py b/mopidy/__main__.py index ea1cab6b..245a03ce 100644 --- a/mopidy/__main__.py +++ b/mopidy/__main__.py @@ -140,7 +140,16 @@ def main(): return 1 for extension in extensions['enabled']: - extension.setup(registry) + try: + extension.setup(registry) + except Exception: + # TODO: would be nice a transactional registry. But sadly this + # is a bit tricky since our current API is giving out a mutable + # list. We might however be able to replace this with a + # collections.Sequence to provide a RO view. + logger.exception('Extension %s failed during setup, this might' + ' have left the registry in a bad state.', + extension.ext_name) # Anything that wants to exit after this point must use # mopidy.internal.process.exit_process as actors can have been started.