]> kaliko git repositories - mpd-sima.git/blobdiff - sima/launch.py
Fixed previous commit, cannot apply shuffle on MetaContainer
[mpd-sima.git] / sima / launch.py
index c548ce9246b33f9c3e6b574e7769246767f07294..68ba4e006b6c6f299b469371e033546feaf3bf8b 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (c) 2013, 2014, 2015 kaliko <kaliko@azylum.org>
+# Copyright (c) 2013, 2014, 2015, 2020 kaliko <kaliko@azylum.org>
 #
 #  This file is part of sima
 #
@@ -37,7 +37,7 @@ from .lib.logger import set_logger
 from .lib.simadb import SimaDB
 from .utils.config import ConfMan
 from .utils.startopt import StartOpt
-from .utils.utils import exception_log, SigHup
+from .utils.utils import exception_log, SigHup, MPDSimaException
 # core plugins
 from .plugins.core.history import History
 from .plugins.core.mpdoptions import MpdOptions
@@ -117,7 +117,6 @@ def start(sopt, restart=False):
 
     #  Loading internal plugins
     load_plugins(sima, 'internal')
-
     #  Loading contrib plugins
     load_plugins(sima, 'contrib')
     logger.info('plugins loaded, prioriy: %s', ' > '.join(map(str, sima.plugins)))
@@ -143,10 +142,14 @@ def run(sopt, restart=False):
     Catches Unhandled exception
     """
     # pylint: disable=broad-except
+    logger = logging.getLogger('sima')
     try:
         start(sopt, restart)
     except SigHup:  # SigHup inherit from Exception
         run(sopt, True)
+    except MPDSimaException as err:
+        logger.error(err)
+        sys.exit(2)
     except Exception:  # Unhandled exception
         exception_log()