Catch exceptions when loading plugins

This commit is contained in:
Philipp Hörist 2018-10-13 14:13:38 +02:00
parent aff0dbe928
commit ec05b1a47e
1 changed files with 6 additions and 1 deletions

View File

@ -179,7 +179,12 @@ class PluginManager(metaclass=Singleton):
:todo: what about adding plug-ins that are already added? Module reload :todo: what about adding plug-ins that are already added? Module reload
and adding class from reloaded module or ignoring adding plug-in? and adding class from reloaded module or ignoring adding plug-in?
''' '''
plugin = plugin_class() try:
plugin = plugin_class()
except Exception:
log.exception('Error while loading a plugin')
return
if plugin not in self.plugins: if plugin not in self.plugins:
if not self._plugin_has_entry_in_global_config(plugin): if not self._plugin_has_entry_in_global_config(plugin):
self._create_plugin_entry_in_global_config(plugin) self._create_plugin_entry_in_global_config(plugin)