PluginManager/PluginExceptions.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1509
c0b5e693b0eb
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
6 """ 6 """
7 Module implementing the exceptions raised by the plugin system. 7 Module implementing the exceptions raised by the plugin system.
8 """ 8 """
9 9
10 from PyQt4.QtGui import QApplication 10 from PyQt4.QtGui import QApplication
11
11 12
12 class PluginError(Exception): 13 class PluginError(Exception):
13 """ 14 """
14 Class defining a special error for the plugin classes. 15 Class defining a special error for the plugin classes.
15 """ 16 """
34 35
35 @return string representing the error message 36 @return string representing the error message
36 """ 37 """
37 return str(self._errorMessage) 38 return str(self._errorMessage)
38 39
40
39 class PluginPathError(PluginError): 41 class PluginPathError(PluginError):
40 """ 42 """
41 Class defining an error raised, when the plugin paths were not found and 43 Class defining an error raised, when the plugin paths were not found and
42 could not be created. 44 could not be created.
43 """ 45 """
44 def __init__(self, msg = None): 46 def __init__(self, msg=None):
45 """ 47 """
46 Constructor 48 Constructor
47 49
48 @param msg message to be used by the exception (string) 50 @param msg message to be used by the exception (string)
49 """ 51 """
50 if msg: 52 if msg:
51 self._errorMessage = msg 53 self._errorMessage = msg
52 else: 54 else:
53 self._errorMessage = \ 55 self._errorMessage = \
54 QApplication.translate("PluginError", 56 QApplication.translate("PluginError",
55 "Plugin paths not found or not creatable.") 57 "Plugin paths not found or not creatable.")
58
56 59
57 class PluginModulesError(PluginError): 60 class PluginModulesError(PluginError):
58 """ 61 """
59 Class defining an error raised, when no plugin modules were found. 62 Class defining an error raised, when no plugin modules were found.
60 """ 63 """
62 """ 65 """
63 Constructor 66 Constructor
64 """ 67 """
65 self._errorMessage = \ 68 self._errorMessage = \
66 QApplication.translate("PluginError", "No plugin modules found.") 69 QApplication.translate("PluginError", "No plugin modules found.")
70
67 71
68 class PluginLoadError(PluginError): 72 class PluginLoadError(PluginError):
69 """ 73 """
70 Class defining an error raised, when there was an error during plugin loading. 74 Class defining an error raised, when there was an error during plugin loading.
71 """ 75 """
77 """ 81 """
78 self._errorMessage = \ 82 self._errorMessage = \
79 QApplication.translate("PluginError", "Error loading plugin module: {0}")\ 83 QApplication.translate("PluginError", "Error loading plugin module: {0}")\
80 .format(name) 84 .format(name)
81 85
86
82 class PluginActivationError(PluginError): 87 class PluginActivationError(PluginError):
83 """ 88 """
84 Class defining an error raised, when there was an error during plugin activation. 89 Class defining an error raised, when there was an error during plugin activation.
85 """ 90 """
86 def __init__(self, name): 91 def __init__(self, name):
91 """ 96 """
92 self._errorMessage = \ 97 self._errorMessage = \
93 QApplication.translate("PluginError", "Error activating plugin module: {0}")\ 98 QApplication.translate("PluginError", "Error activating plugin module: {0}")\
94 .format(name) 99 .format(name)
95 100
101
96 class PluginModuleFormatError(PluginError): 102 class PluginModuleFormatError(PluginError):
97 """ 103 """
98 Class defining an error raised, when the plugin module is invalid. 104 Class defining an error raised, when the plugin module is invalid.
99 """ 105 """
100 def __init__(self, name, missing): 106 def __init__(self, name, missing):
103 109
104 @param name name of the plugin module (string) 110 @param name name of the plugin module (string)
105 @param missing description of the missing element (string) 111 @param missing description of the missing element (string)
106 """ 112 """
107 self._errorMessage = \ 113 self._errorMessage = \
108 QApplication.translate("PluginError", 114 QApplication.translate("PluginError",
109 "The plugin module {0} is missing {1}.")\ 115 "The plugin module {0} is missing {1}.")\
110 .format(name, missing) 116 .format(name, missing)
117
111 118
112 class PluginClassFormatError(PluginError): 119 class PluginClassFormatError(PluginError):
113 """ 120 """
114 Class defining an error raised, when the plugin module's class is invalid. 121 Class defining an error raised, when the plugin module's class is invalid.
115 """ 122 """
120 @param name name of the plugin module (string) 127 @param name name of the plugin module (string)
121 @param class_ name of the class not satisfying the requirements (string) 128 @param class_ name of the class not satisfying the requirements (string)
122 @param missing description of the missing element (string) 129 @param missing description of the missing element (string)
123 """ 130 """
124 self._errorMessage = \ 131 self._errorMessage = \
125 QApplication.translate("PluginError", 132 QApplication.translate("PluginError",
126 "The plugin class {0} of module {1} is missing {2}.")\ 133 "The plugin class {0} of module {1} is missing {2}.")\
127 .format(class_, name, missing) 134 .format(class_, name, missing)

eric ide

mercurial