Unloading conflicting plugin before crashing
This commit is contained in:
parent
fb2c243255
commit
fd7ad82e2f
@ -28,18 +28,19 @@ class PluginRepository:
|
||||
# create instance
|
||||
plugin_instance = self._registered_plugins[plugin]() # config is statically loaded
|
||||
|
||||
# store instance
|
||||
self._loaded_plugins[plugin] = plugin_instance
|
||||
|
||||
# load compilers
|
||||
compilers = plugin_instance.load_compilers()
|
||||
|
||||
if set(compilers.keys()).intersection(self._command_compilers.keys()):
|
||||
plugin_instance.close() # The program should stop at this point anyways
|
||||
raise ConflictingPlugins(f"Conflicting plugin is tried to be loaded: {plugin}")
|
||||
|
||||
# Store commands
|
||||
self._command_compilers.update(compilers)
|
||||
|
||||
# store instance
|
||||
self._loaded_plugins[plugin] = plugin_instance
|
||||
|
||||
# log stuff
|
||||
self._logger.info(f"Loaded plugin: {plugin}")
|
||||
self._logger.debug(f"Plugin {plugin} loaded the following commands: {', '.join(compilers.keys())}")
|
||||
|
Loading…
Reference in New Issue
Block a user