src/eric7/PluginManager/PluginManager.py

branch
eric7
changeset 9299
e40589582f82
parent 9221
bf71ee032bb4
child 9413
80c06d472826
--- a/src/eric7/PluginManager/PluginManager.py	Fri Aug 26 14:49:15 2022 +0200
+++ b/src/eric7/PluginManager/PluginManager.py	Mon Aug 29 13:30:08 2022 +0200
@@ -599,9 +599,12 @@
         Public method to activate a plugin.
 
         @param name name of the module to be activated
+        @type str
         @param onDemand flag indicating activation of an
-            on demand plugin (boolean)
-        @return reference to the initialized plugin object
+            on demand plugin
+        @type bool
+        @return reference to the initialized plugin object and an error string
+        @rtype tuple of (QObject, str)
         @exception PluginActivationError raised to indicate an issue during the
             plug-in activation
         """
@@ -613,7 +616,7 @@
                     else self.__inactiveModules[name]
                 )
             except KeyError:
-                return None
+                return None, f"no such plugin module: {name}"
 
             if not self.__canActivatePlugin(module):
                 raise PluginActivationError(module.eric7PluginModuleName)
@@ -639,7 +642,7 @@
                 obj = None
                 ok = False
             if not ok:
-                return None
+                return None, module.error
 
             self.pluginActivated.emit(name, pluginObject)
             pluginObject.eric7PluginModule = module
@@ -658,9 +661,9 @@
                     self.__inactivePlugins.pop(name)
                 self.__activePlugins[name] = pluginObject
                 self.__activeModules[name] = module
-            return obj
-        except PluginActivationError:
-            return None
+            return obj, ""
+        except PluginActivationError as err:
+            return None, str(err)
 
     def __canActivatePlugin(self, module):
         """
@@ -758,11 +761,15 @@
         Public method to activate an ondemand plugin given by type and
         typename.
 
-        @param type_ type of the plugin to be activated (string)
-        @param typename name of the plugin within the type category (string)
+        @param type_ type of the plugin to be activated
+        @type str
+        @param typename name of the plugin within the type category
+        @type str
         @param maybeActive flag indicating, that the plugin may be active
-            already (boolean)
-        @return reference to the initialized plugin object
+            already
+        @type bool
+        @return reference to the initialized plugin object and an error string
+        @rtype tuple of (QObject, str)
         """
         for name, module in list(self.__onDemandInactiveModules.items()):
             if (
@@ -780,7 +787,7 @@
                     self.deactivatePlugin(name, onDemand=True)
                     return self.activatePlugin(name, onDemand=True)
 
-        return None
+        return None, f"no plugin module of type {type_}: {typename}"
 
     def getPluginInfos(self):
         """

eric ide

mercurial