Revision 797506fc

b/lib/cli.py
1302 1302
    obuf.write("Parameter Error: %s" % msg)
1303 1303
  elif isinstance(err, errors.ParameterError):
1304 1304
    obuf.write("Failure: unknown/wrong parameter name '%s'" % msg)
1305
  elif isinstance(err, errors.GenericError):
1306
    obuf.write("Unhandled Ganeti error: %s" % msg)
1307 1305
  elif isinstance(err, luxi.NoMasterError):
1308 1306
    obuf.write("Cannot communicate with the master daemon.\nIs it running"
1309 1307
               " and listening for connections?")
......
1313 1311
  elif isinstance(err, luxi.ProtocolError):
1314 1312
    obuf.write("Unhandled protocol error while talking to the master daemon:\n"
1315 1313
               "%s" % msg)
1314
  elif isinstance(err, errors.GenericError):
1315
    obuf.write("Unhandled Ganeti error: %s" % msg)
1316 1316
  elif isinstance(err, JobSubmittedException):
1317 1317
    obuf.write("JobID: %s\n" % err.args[0])
1318 1318
    retcode = 0
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