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  """ 
 23  serializable Flumotion exceptions 
 24  """ 
 25   
 26  from twisted.spread import pb 
 27   
28 -class CancelledError(Exception):
29 "An operation was cancelled"
30
31 -class OptionError(Exception):
32 "Error in options"
33 -class ConfigError(Exception):
34 """ 35 Error during parsing of configuration 36 37 args[0]: str 38 """
39 -class NoProjectError(Exception):
40 "The given project does not exist"
41
42 -class NoSSLError(Exception):
43 "SSL is not available"
44 45 # connection errors
46 -class ConnectionError(pb.Error):
47 "General connection error"
48
49 -class NotConnectedError(ConnectionError):
50 "Not connected"
51
52 -class NotAuthenticatedError(ConnectionError):
53 "Not authenticated"
54
55 -class ConnectionRefusedError(ConnectionError):
56 "Connection refused"
57
58 -class ConnectionFailedError(ConnectionError):
59 "Connection failed"
60
61 -class ConnectionCancelledError(ConnectionError):
62 "Connection attempt cancelled"
63
64 -class ManagerNotConnectedError(NotConnectedError):
65 "Manager not connected"
66
67 -class AlreadyConnectingError(ConnectionError):
68 "Already connecting"
69
70 -class AlreadyConnectedError(ConnectionError):
71 "Already connected"
72
73 -class PipelineParseError(pb.Error):
74 "An error occurred while trying to parse the pipeline"
75 76 # remote method errors
77 -class RemoteMethodError(pb.Error):
78 """ 79 Generic remote method error. 80 81 @ivar methodName: name of the method 82 @type methodName: str 83 @ivar debug: optional additional debug message 84 @type debug: str 85 """
86 - def __init__(self, methodName, debug=None):
87 self.methodName = methodName 88 self.debug = debug 89 # work like a normal Exception too 90 self.args = (methodName, debug)
91 92 # this allows us to decide how it gets serialized
93 - def __str__(self):
94 msg = "%s on method '%s'" % (self.__class__.__name__, self.methodName) 95 if self.debug: 96 msg += " (%s)" % self.debug 97 return msg
98
99 -class RemoteRunError(RemoteMethodError):
100 "Error while running remote code, before getting a result"
101
102 -class RemoteRunFailure(RemoteMethodError):
103 "A remote method generated a failure result"
104
105 -class NoMethodError(RemoteMethodError):
106 "The remote method does not exist"
107 108 # FIXME: subclass from both entry/bundle and syntax errors ? 109 # FIXME: name ?
110 -class EntrySyntaxError(pb.Error):
111 "Syntax error while getting entry point in a bundle"
112 113 # other errors
114 -class NotReadyError(pb.Error):
115 "The component is not ready yet"
116
117 -class PropertyError(pb.Error):
118 "An error occurred while setting a property on the component"
119
120 -class NoPerspectiveError(pb.Error):
121 "The component does not have a perspective"
122
123 -class SystemError(pb.Error):
124 "A system error, is usually fatal"
125
126 -class ReloadSyntaxError(pb.Error):
127 "A syntax error during a reload of a module"
128
129 -class WrongStateError(pb.Error):
130 "The remote object was in the wrong state for this command"
131
132 -class InsufficientPrivilegesError(pb.Error):
133 "You do not have the necessary privileges to complete this operation"
134 135 # component errors
136 -class ComponentError(pb.Error):
137 """ 138 Error while doing something to a component. 139 140 args[0]: ComponentState 141 """
142 143 # FIXME: rename, component first
144 -class SleepingComponentError(ComponentError):
145 "Component is sleeping, cannot handle request"
146
147 -class ComponentAlreadyStartingError(ComponentError):
148 "Component told to start, but is already starting"
149
150 -class ComponentAlreadyRunningError(ComponentError):
151 "Component told to start, but is already running"
152
153 -class ComponentMoodError(ComponentError):
154 "Component is in the wrong mood to perform the given function"
155
156 -class ComponentNoWorkerError(ComponentError):
157 "Component does not have its worker available"
158
159 -class BusyComponentError(ComponentError):
160 """ 161 Component is busy doing something. 162 163 args[0]: ComponentState 164 args[1]: str 165 """
166
167 -class ComponentConfigError(ComponentError):
168 """ 169 An error in the configuration of the component. 170 171 args[0]: ComponentState 172 args[1]: str 173 """
174
175 -class ComponentAlreadyExistsError(ComponentError):
176 """ 177 A component name is already used. 178 179 args[0]: L{flumotion.common.common.componentId} 180 """
181
182 -class ComponentCreateError(ComponentError):
183 """ 184 An error during creation of a component. Can be raised during a 185 remote_create call on a worker. 186 """
187
188 -class HandledException(Exception):
189 """ 190 An exception that has already been adequately handled, but still needs 191 to be propagated to indicate failure to callers. 192 193 This allows callers and defgens to propagate gracefully without 194 doing a traceback, while still doing tracebacks for unhandled exceptions. 195 196 Only argument is the original exception or failure. 197 """
198
199 -class ComponentSetupError(ComponentError):
200 """ 201 An error during setup of a component. Can be raised during a 202 remote_setup call on a component. 203 """
204
205 -class ComponentStartError(ComponentError):
206 """ 207 An error during starting of a component. Can be raised during a 208 remote_start call on a component. 209 """
210
211 -class ComponentSetupHandledError(ComponentSetupError, HandledException):
212 """ 213 An error during setup of a component, that's already handled in a 214 different way (for example, through a message). 215 Can be raised during a remote_setup call on a component. 216 """
217
218 -class ComponentStartHandledError(ComponentStartError, HandledException):
219 """ 220 An error during starting of a component, that's already handled in a 221 different way (for example, through a message). 222 Can be raised during a remote_start call on a component. 223 """
224
225 -class UnknownComponentError(ComponentError):
226 "A given component or component type does not exist"
227
228 -class UnknownPlugError(pb.Error):
229 "A given plug type does not exist"
230 231 # effect errors
232 -class UnknownEffectError(pb.Error):
233 "A given effect or effect type does not exist"
234
235 -class FlumotionError(pb.Error):
236 "Generic Flumotion error"
237
238 -class NoBundleError(pb.Error):
239 "The requested bundle was not found"
240
241 -class TimeoutException(Exception):
242 "Timed out"
243 244 # serializable GStreamer errors
245 -class GStreamerError(pb.Error):
246 "Generic GStreamer error"
247
248 -class GStreamerGstError(GStreamerError):
249 """GStreamer-generated error with source, GError and debug string as args"""
250
251 -class MissingElementError(GStreamerError):
252 "A needed element is missing"
253