core: check uncatched exceptions during plugin import and stdui init, log error and exit if any found

This commit is contained in:
Goffi 2017-06-21 19:40:13 +02:00
commit e30f22ec4c

View file

@ -147,9 +147,14 @@ class SAT(service.Service):
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"))