Revision 7bca53e4

b/daemons/ganeti-watcher
53 53
KEY_BOOT_ID = "bootid"
54 54

  
55 55

  
56
class Error(Exception):
57
  """Generic custom error class."""
58

  
59

  
60
class NotMasterError(Error):
56
class NotMasterError(errors.GenericError):
61 57
  """Exception raised when this host is not the master."""
62 58

  
63 59

  
......
84 80
  res = utils.RunCmd(cmd)
85 81

  
86 82
  if res.failed:
87
    raise Error("Command %s failed:\n%s\nstdout:\n%sstderr:\n%s" %
88
                (repr(cmd),
89
                 Indent(res.fail_reason),
90
                 Indent(res.stdout),
91
                 Indent(res.stderr)))
83
    msg = ("Command %s failed:\n%s\nstdout:\n%sstderr:\n%s" %
84
           (repr(cmd),
85
            Indent(res.fail_reason),
86
            Indent(res.stdout),
87
            Indent(res.stderr)))
88
    raise errors.CommandError(msg)
92 89

  
93 90
  return res
94 91

  
......
101 98
    fcntl.flock(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
102 99
  except IOError, err:
103 100
    if err.errno == errno.EAGAIN:
104
      raise StandardError("File already locked")
101
      raise errors.LockError("File already locked")
105 102
    raise
106 103

  
107 104

  
......
112 109
  def __init__(self):
113 110
    """Open, lock, read and parse the file.
114 111

  
115
    Raises StandardError on lock contention.
112
    Raises exception on lock contention.
116 113

  
117 114
    """
118 115
    # The two-step dance below is necessary to allow both opening existing
b/lib/errors.py
210 210
  The argument to this exception will show the exact error.
211 211

  
212 212
  """
213

  
214

  
215
class CommandError(GenericError):
216
  """External command error.
217

  
218
  """

Also available in: Unified diff