Package flumotion :: Package common :: Module errors
[hide private]

Source Code for Module flumotion.common.errors

  1  # -*- Mode: Python -*- 
  2  # vi:si:et:sw=4:sts=4:ts=4 
  3  # 
  4  # Flumotion - a streaming media server 
  5  # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 
  6  # All rights reserved. 
  7   
  8  # This file may be distributed and/or modified under the terms of 
  9  # the GNU General Public License version 2 as published by 
 10  # the Free Software Foundation. 
 11  # This file is distributed without any warranty; without even the implied 
 12  # warranty of merchantability or fitness for a particular purpose. 
 13  # See "LICENSE.GPL" in the source distribution for more information. 
 14   
 15  # Licensees having purchased or holding a valid Flumotion Advanced 
 16  # Streaming Server license may use this file in accordance with the 
 17  # Flumotion Advanced Streaming Server Commercial License Agreement. 
 18  # See "LICENSE.Flumotion" in the source distribution for more information. 
 19   
 20  # Headers in this file shall remain intact. 
 21   
 22  """exceptions used by Flumotion, serializable and normal 
 23  """ 
 24   
 25  from twisted.spread import pb 
 26   
 27  __version__ = "$Rev: 7039 $" 
 28   
 29   
30 -class CancelledError(Exception):
31 "An operation was cancelled"
32 33
34 -class OptionError(Exception):
35 "Error in options"
36 37
38 -class ConfigError(Exception):
39 """ 40 Error during parsing of configuration 41 42 args[0]: str 43 """
44
45 -class NoProjectError(Exception):
46 "The given project does not exist"
47 48
49 -class NoSSLError(Exception):
50 "SSL is not available"
51 52 53 # connection errors
54 -class ConnectionError(pb.Error):
55 "General connection error"
56 57
58 -class NotConnectedError(ConnectionError):
59 "Not connected"
60 61
62 -class NotAuthenticatedError(ConnectionError):
63 "Not authenticated"
64 65
66 -class ConnectionRefusedError(ConnectionError):
67 "Connection refused"
68 69
70 -class ConnectionFailedError(ConnectionError):
71 "Connection failed"
72 73
74 -class ConnectionCancelledError(ConnectionError):
75 "Connection attempt cancelled"
76 77
78 -class ManagerNotConnectedError(NotConnectedError):
79 "Manager not connected"
80 81
82 -class AlreadyConnectingError(ConnectionError):
83 "Already connecting"
84 85
86 -class AlreadyConnectedError(ConnectionError):
87 "Already connected"
88 89
90 -class PipelineParseError(pb.Error):
91 "An error occurred while trying to parse the pipeline"
92 93 94 # remote method errors
95 -class RemoteMethodError(pb.Error):
96 """ 97 Generic remote method error. 98 99 @ivar methodName: name of the method 100 @type methodName: str 101 @ivar debug: optional additional debug message 102 @type debug: str 103 """
104 - def __init__(self, methodName, debug=None):
105 self.methodName = methodName 106 self.debug = debug 107 # work like a normal Exception too 108 self.args = (methodName, debug)
109 110 # this allows us to decide how it gets serialized
111 - def __str__(self):
112 msg = "%s on method '%s'" % (self.__class__.__name__, self.methodName) 113 if self.debug: 114 msg += " (%s)" % self.debug 115 return msg
116 117
118 -class RemoteRunError(RemoteMethodError):
119 "Error while running remote code, before getting a result"
120 121
122 -class RemoteRunFailure(RemoteMethodError):
123 "A remote method generated a failure result"
124 125
126 -class NoMethodError(RemoteMethodError):
127 "The remote method does not exist"
128 129 130 # FIXME: subclass from both entry/bundle and syntax errors ? 131 # FIXME: name ?
132 -class EntrySyntaxError(pb.Error):
133 "Syntax error while getting entry point in a bundle"
134 135 136 # other errors
137 -class NotReadyError(pb.Error):
138 "The component is not ready yet"
139 140
141 -class PropertyError(pb.Error):
142 "An error occurred while setting a property on the component"
143 144
145 -class NoPerspectiveError(pb.Error):
146 "The component does not have a perspective"
147
148 -class FatalError(pb.Error):
149 "A fatal error"
150 151 # F0.8 152 __pychecker__ = 'no-shadowbuiltin'
153 -class SystemError(FatalError):
154 - def __init__(self, *args, **kwargs):
155 import warnings 156 warnings.warn("Please use builtin SystemError or errors.FatalError", 157 DeprecationWarning, stacklevel=2) 158 pb.Error.__init__(self, *args, **kwargs)
159 __pychecker__ = '' 160
161 -class ReloadSyntaxError(pb.Error):
162 "A syntax error during a reload of a module"
163 164
165 -class WrongStateError(pb.Error):
166 "The remote object was in the wrong state for this command"
167 168
169 -class InsufficientPrivilegesError(pb.Error):
170 "You do not have the necessary privileges to complete this operation"
171 172 173 # component errors
174 -class ComponentError(pb.Error):
175 """ 176 Error while doing something to a component. 177 178 args[0]: ComponentState 179 """
180 181 182 # FIXME: rename, component first
183 -class SleepingComponentError(ComponentError):
184 "Component is sleeping, cannot handle request"
185 186
187 -class ComponentAlreadyStartingError(ComponentError):
188 "Component told to start, but is already starting"
189 190
191 -class ComponentAlreadyRunningError(ComponentError):
192 "Component told to start, but is already running"
193 194
195 -class ComponentMoodError(ComponentError):
196 "Component is in the wrong mood to perform the given function"
197 198
199 -class ComponentNoWorkerError(ComponentError):
200 "Component does not have its worker available"
201 202
203 -class BusyComponentError(ComponentError):
204 """ 205 Component is busy doing something. 206 207 args[0]: ComponentState 208 args[1]: str 209 """
210 211
212 -class ComponentConfigError(ComponentError):
213 """ 214 An error in the configuration of the component. 215 216 args[0]: ComponentState 217 args[1]: str 218 """
219 220
221 -class ComponentAlreadyExistsError(ComponentError):
222 """ 223 A component name is already used. 224 225 args[0]: L{flumotion.common.common.componentId} 226 """
227 228
229 -class ComponentCreateError(ComponentError):
230 """ 231 An error during creation of a component. Can be raised during a 232 remote_create call on a worker. 233 """
234 235
236 -class HandledException(Exception):
237 """ 238 An exception that has already been adequately handled, but still needs 239 to be propagated to indicate failure to callers. 240 241 This allows callers and defgens to propagate gracefully without 242 doing a traceback, while still doing tracebacks for unhandled exceptions. 243 244 Only argument is the original exception or failure. 245 """
246 247
248 -class ComponentSetupError(ComponentError):
249 """ 250 An error during setup of a component. Can be raised during a 251 remote_setup call on a component. 252 """
253 254
255 -class ComponentStartError(ComponentError):
256 """ 257 An error during starting of a component. Can be raised during a 258 remote_start call on a component. 259 """
260 261
262 -class ComponentSetupHandledError(ComponentSetupError, HandledException):
263 """ 264 An error during setup of a component, that's already handled in a 265 different way (for example, through a message). 266 Can be raised during a remote_setup call on a component. 267 """
268 269
270 -class ComponentStartHandledError(ComponentStartError, HandledException):
271 """ 272 An error during starting of a component, that's already handled in a 273 different way (for example, through a message). 274 Can be raised during a remote_start call on a component. 275 """
276 277
278 -class UnknownComponentError(ComponentError):
279 "A given component or component type does not exist"
280 281
282 -class ComponentValidationError(ComponentError):
283 "The configuration for the component is not valid"
284 285
286 -class UnknownPlugError(pb.Error):
287 "A given plug type does not exist"
288 289 290 # effect errors
291 -class UnknownEffectError(pb.Error):
292 "A given effect or effect type does not exist"
293 294
295 -class FlumotionError(pb.Error):
296 "Generic Flumotion error"
297 298
299 -class NoBundleError(pb.Error):
300 "The requested bundle was not found"
301 302
303 -class TimeoutException(Exception):
304 "Timed out"
305 306 307 # serializable GStreamer errors
308 -class GStreamerError(pb.Error):
309 "Generic GStreamer error"
310 311
312 -class GStreamerGstError(GStreamerError):
313 """GStreamer-generated error with source, GError and debug string as args"""
314 315
316 -class MissingElementError(GStreamerError):
317 "A needed element is missing"
318 319
320 -class AccessDeniedError(Exception):
321 "Access is denied to this object, usually a file or directory"
322