Package qpid :: Package messaging :: Module exceptions
[frames] | no frames]

Source Code for Module qpid.messaging.exceptions

  1  # 
  2  # Licensed to the Apache Software Foundation (ASF) under one 
  3  # or more contributor license agreements.  See the NOTICE file 
  4  # distributed with this work for additional information 
  5  # regarding copyright ownership.  The ASF licenses this file 
  6  # to you under the Apache License, Version 2.0 (the 
  7  # "License"); you may not use this file except in compliance 
  8  # with the License.  You may obtain a copy of the License at 
  9  # 
 10  #   http://www.apache.org/licenses/LICENSE-2.0 
 11  # 
 12  # Unless required by applicable law or agreed to in writing, 
 13  # software distributed under the License is distributed on an 
 14  # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
 15  # KIND, either express or implied.  See the License for the 
 16  # specific language governing permissions and limitations 
 17  # under the License. 
 18  # 
 19   
20 -class Timeout(Exception):
21 pass
22 23 ## Messaging Errors 24
25 -class MessagingError(Exception):
26
27 - def __init__(self, code=None, text=None, **info):
28 self.code = code 29 self.text = text 30 self.info = info 31 if self.code is None: 32 msg = self.text 33 else: 34 msg = "%s(%s)" % (self.text, self.code) 35 if info: 36 msg += " " + ", ".join(["%s=%r" % (k, v) for k, v in self.info.items()]) 37 Exception.__init__(self, msg)
38 -class InternalError(MessagingError):
39 pass
40 41 ## Connection Errors 42
43 -class ConnectionError(MessagingError):
44 """ 45 The base class for all connection related exceptions. 46 """ 47 pass
48
49 -class ConnectError(ConnectionError):
50 """ 51 Exception raised when there is an error connecting to the remote 52 peer. 53 """ 54 pass
55
56 -class VersionError(ConnectError):
57 pass
58
59 -class AuthenticationFailure(ConnectError):
60 pass
61
62 -class ConnectionClosed(ConnectionError):
63 pass
64
65 -class HeartbeatTimeout(ConnectionError):
66 pass
67 68 ## Session Errors 69
70 -class SessionError(MessagingError):
71 pass
72
73 -class Detached(SessionError):
74 """ 75 Exception raised when an operation is attempted that is illegal when 76 detached. 77 """ 78 pass
79
80 -class NontransactionalSession(SessionError):
81 """ 82 Exception raised when commit or rollback is attempted on a non 83 transactional session. 84 """ 85 pass
86
87 -class TransactionError(SessionError):
88 """Base class for transactional errors""" 89 pass
90
91 -class TransactionAborted(TransactionError):
92 """The transaction was automatically rolled back. This could be due to an error 93 on the broker, such as a store failure, or a connection failure during the 94 transaction""" 95 pass
96
97 -class TransactionUnknown(TransactionError):
98 """ The outcome of the transaction on the broker (commit or roll-back) is not 99 known. This occurs when the connection fails after we sent the commit but 100 before we received a response.""" 101 pass
102
103 -class UnauthorizedAccess(SessionError):
104 pass
105
106 -class ServerError(SessionError):
107 pass
108
109 -class SessionClosed(SessionError):
110 pass
111 112 ## Link Errors 113
114 -class LinkError(MessagingError):
115 pass
116
117 -class InsufficientCapacity(LinkError):
118 pass
119
120 -class AddressError(LinkError):
121 pass
122
123 -class MalformedAddress(AddressError):
124 pass
125
126 -class InvalidOption(AddressError):
127 pass
128
129 -class ResolutionError(AddressError):
130 pass
131
132 -class AssertionFailed(ResolutionError):
133 pass
134
135 -class NotFound(ResolutionError):
136 pass
137
138 -class LinkClosed(LinkError):
139 pass
140 141 ## Sender Errors 142
143 -class SenderError(LinkError):
144 pass
145
146 -class SendError(SenderError):
147 pass
148
149 -class TargetCapacityExceeded(SendError):
150 pass
151 152 ## Receiver Errors 153
154 -class ReceiverError(LinkError):
155 pass
156
157 -class FetchError(ReceiverError):
158 pass
159
160 -class Empty(FetchError):
161 """ 162 Exception raised by L{Receiver.fetch} when there is no message 163 available within the alloted time. 164 """ 165 pass
166 167 ## Message Content errors
168 -class ContentError(MessagingError):
169 """ 170 This type of exception will be returned to the application 171 once, and will not block further requests 172 """ 173 pass
174
175 -class EncodeError(ContentError):
176 pass
177
178 -class DecodeError(ContentError):
179 pass
180