Revision 797506fc lib/luxi.py

b/lib/luxi.py
63 63
DEF_RWTO = 60
64 64

  
65 65

  
66
class ProtocolError(Exception):
67
  """Denotes an error in the server communication"""
66
class ProtocolError(errors.GenericError):
67
  """Denotes an error in the LUXI protocol"""
68 68

  
69 69

  
70 70
class ConnectionClosedError(ProtocolError):
......
75 75
  """Operation timeout error"""
76 76

  
77 77

  
78
class EncodingError(ProtocolError):
79
  """Encoding failure on the sending side"""
80

  
81

  
82
class DecodingError(ProtocolError):
83
  """Decoding failure on the receiving side"""
84

  
85

  
86 78
class RequestError(ProtocolError):
87 79
  """Error on request
88 80

  
......
185 177

  
186 178
    """
187 179
    if self.eom in msg:
188
      raise EncodingError("Message terminator found in payload")
180
      raise ProtocolError("Message terminator found in payload")
181

  
189 182
    self._CheckSocket()
190 183
    try:
191 184
      # TODO: sendall is not guaranteed to send everything
......
320 313
    if (not isinstance(data, dict) or
321 314
        KEY_SUCCESS not in data or
322 315
        KEY_RESULT not in data):
323
      raise DecodingError("Invalid response from server: %s" % str(data))
316
      raise ProtocolError("Invalid response from server: %s" % str(data))
324 317

  
325 318
    result = data[KEY_RESULT]
326 319

  

Also available in: Unified diff