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