changeset 2262:24f5a4d5f195

core: check uncatched exceptions during plugin import and stdui init, log error and exit if any found
author Goffi <goffi@goffi.org>
date Wed, 21 Jun 2017 19:40:13 +0200 (2017-06-21)
parents 8be4f5769bf7
children 90189f312fd3
files src/core/sat_main.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/sat_main.py	Wed Jun 21 19:36:00 2017 +0200
+++ b/src/core/sat_main.py	Wed Jun 21 19:40:13 2017 +0200
@@ -147,9 +147,14 @@
     def _postMemoryInit(self, ignore):
         """Method called after memory initialization is done"""
         log.info(_("Memory initialised"))
-        self._import_plugins()
-        ui_contact_list.ContactList(self)
-        ui_profile_manager.ProfileManager(self)
+        try:
+            self._import_plugins()
+            ui_contact_list.ContactList(self)
+            ui_profile_manager.ProfileManager(self)
+        except Exception as e:
+            log.error(_(u"Could not initialize backend: {reason}").format(
+                reason = str(e).decode('utf-8', 'ignore')))
+            sys.exit(1)
         self.initialised.callback(None)
         log.info(_(u"Backend is ready"))