28 msg = "" |
28 msg = "" |
29 def __str__(self): |
29 def __str__(self): |
30 if self.msg: |
30 if self.msg: |
31 if self.args: |
31 if self.args: |
32 return self.msg % tuple(self.args) |
32 return self.msg % tuple(self.args) |
33 return self.msg |
33 else: |
34 return ' '.join(unicode(arg) for arg in self.args) |
34 return self.msg |
35 |
35 else: |
|
36 return u' '.join(unicode(arg) for arg in self.args) |
36 |
37 |
37 class ConfigurationError(CubicWebException): |
38 class ConfigurationError(CubicWebException): |
38 """a misconfiguration error""" |
39 """a misconfiguration error""" |
39 |
40 |
40 class InternalError(CubicWebException): |
41 class InternalError(CubicWebException): |
79 """usually due to bad multisources configuration or rql query""" |
80 """usually due to bad multisources configuration or rql query""" |
80 |
81 |
81 class UniqueTogetherError(RepositoryError): |
82 class UniqueTogetherError(RepositoryError): |
82 """raised when a unique_together constraint caused an IntegrityError""" |
83 """raised when a unique_together constraint caused an IntegrityError""" |
83 |
84 |
|
85 |
84 # security exceptions ######################################################### |
86 # security exceptions ######################################################### |
85 |
87 |
86 class Unauthorized(SecurityError): |
88 class Unauthorized(SecurityError): |
87 """raised when a user tries to perform an action without sufficient |
89 """raised when a user tries to perform an action without sufficient |
88 credentials |
90 credentials |
126 class NotAnEntity(CubicWebRuntimeError): |
128 class NotAnEntity(CubicWebRuntimeError): |
127 """raised when get_entity is called for a column which doesn't contain |
129 """raised when get_entity is called for a column which doesn't contain |
128 a non final entity |
130 a non final entity |
129 """ |
131 """ |
130 |
132 |
|
133 class UndoTransactionException(QueryError): |
|
134 """Raised when undoing a transaction could not be performed completely. |
|
135 |
|
136 Note that : |
|
137 1) the partial undo operation might be acceptable |
|
138 depending upon the final application |
|
139 |
|
140 2) the undo operation can also fail with a `ValidationError` in |
|
141 cases where the undoing breaks integrity constraints checked |
|
142 immediately. |
|
143 |
|
144 3) It might be that neither of those exception is raised but a |
|
145 subsequent `commit` might raise a `ValidationError` in cases |
|
146 where the undoing breaks integrity constraints checked at |
|
147 commit time. |
|
148 |
|
149 :type txuuix: int |
|
150 :param txuuid: Unique identifier of the partialy undone transaction |
|
151 |
|
152 :type errors: list |
|
153 :param errors: List of errors occured during undoing |
|
154 """ |
|
155 msg = u"The following error(s) occured while undoing transaction #%d : %s" |
|
156 |
|
157 def __init__(self, txuuid, errors): |
|
158 super(UndoTransactionException, self).__init__(txuuid, errors) |
|
159 self.txuuid = txuuid |
|
160 self.errors = errors |
|
161 |
131 # tools exceptions ############################################################ |
162 # tools exceptions ############################################################ |
132 |
163 |
133 class ExecutionError(Exception): |
164 class ExecutionError(Exception): |
134 """server execution control error (already started, not running...)""" |
165 """server execution control error (already started, not running...)""" |
135 |
166 |