blob: 7154b80fb4926c762c58d81c9ceccc1420f6a292 [file] [log] [blame]
Jay Pipes5135bfc2012-01-05 15:46:49 -05001class TempestException(Exception):
2 """
3 Base Tempest Exception
4
5 To correctly use this class, inherit from it and define
6 a 'message' property. That message will get printf'd
7 with the keyword arguments provided to the constructor.
8 """
9 message = "An unknown exception occurred"
10
11 def __init__(self, *args, **kwargs):
12 try:
13 self._error_string = self.message % kwargs
14 except Exception:
15 # at least get the core message out if something happened
16 self._error_string = self.message
17 if len(args) > 0:
18 # If there is a non-kwarg parameter, assume it's the error
19 # message or reason description and tack it on to the end
20 # of the exception message
21 # Convert all arguments into their string representations...
22 args = ["%s" % arg for arg in args]
23 self._error_string = (self._error_string +
24 "\nDetails: %s" % '\n'.join(args))
Daryl Walleckf0087032011-12-18 13:37:05 -060025
26 def __str__(self):
Jay Pipes5135bfc2012-01-05 15:46:49 -050027 return self._error_string
Daryl Walleck1465d612011-11-02 02:22:15 -050028
29
Daryl Walleck587385b2012-03-03 13:00:26 -060030class InvalidConfiguration(TempestException):
31 message = "Invalid Configuration"
32
33
Jay Pipes5135bfc2012-01-05 15:46:49 -050034class NotFound(TempestException):
35 message = "Object not found"
Daryl Walleckadea1fa2011-11-15 18:36:39 -060036
37
Daryl Walleckced8eb82012-03-19 13:52:37 -050038class Unauthorized(TempestException):
39 message = 'Unauthorized'
40
41
Jay Pipes5135bfc2012-01-05 15:46:49 -050042class TimeoutException(TempestException):
43 message = "Request timed out"
Brian Lamar12d9b292011-12-08 12:41:21 -050044
45
Jay Pipes5135bfc2012-01-05 15:46:49 -050046class BuildErrorException(TempestException):
47 message = "Server %(server_id)s failed to build and is in ERROR status"
Daryl Wallecked8bef32011-12-05 23:02:08 -060048
49
Katherine Elliott74f68512012-05-18 10:19:22 -060050class AddImageException(TempestException):
51 message = "Image %(image_id) failed to become ACTIVE in the allotted time"
52
53
rajalakshmi-ganesane3bb58f2012-05-16 12:01:15 +053054class VolumeBuildErrorException(TempestException):
55 message = "Volume %(volume_id)s failed to build and is in ERROR status"
56
57
Jay Pipes5135bfc2012-01-05 15:46:49 -050058class BadRequest(TempestException):
59 message = "Bad request"
Adam Gandelmane2d46b42012-01-03 17:40:44 -080060
61
Jay Pipes5135bfc2012-01-05 15:46:49 -050062class AuthenticationFailure(TempestException):
63 message = ("Authentication with user %(user)s and password "
64 "%(password)s failed")
Brian Waldon738cd632011-12-12 18:45:09 -050065
66
Jay Pipes5135bfc2012-01-05 15:46:49 -050067class EndpointNotFound(TempestException):
68 message = "Endpoint not found"
Brian Waldon738cd632011-12-12 18:45:09 -050069
Jay Pipes5135bfc2012-01-05 15:46:49 -050070
Jay Pipes9b043842012-01-23 23:34:26 -050071class RateLimitExceeded(TempestException):
72 message = ("Rate limit exceeded.\nMessage: %(message)s\n"
73 "Details: %(details)s")
74
75
Jay Pipes5135bfc2012-01-05 15:46:49 -050076class OverLimit(TempestException):
77 message = "Quota exceeded"
78
79
80class ComputeFault(TempestException):
81 message = "Got compute fault"
82
83
Jay Pipesedba0622012-07-08 21:34:36 -040084class IdentityError(TempestException):
85 message = "Got identity error"
86
87
Jay Pipes5135bfc2012-01-05 15:46:49 -050088class Duplicate(TempestException):
89 message = "An object with that identifier already exists"
Daryl Walleck6b9b2882012-04-08 21:43:39 -050090
91
92class SSHTimeout(TempestException):
93 message = ("Connection to the %(host)s via SSH timed out.\n"
Jaroslav Hennerab327842012-09-11 15:44:29 +020094 "User: %(user)s, Password: %(password)s")
95
96
97class SSHExecCommandFailed(TempestException):
98 ''' Raised when remotely executed command returns nonzero status. '''
99 message = ("Command '%(command)s', exit status: %(exit_status)d, "
100 "Error:\n%(strerror)s")
Daryl Walleck6b9b2882012-04-08 21:43:39 -0500101
102
103class ServerUnreachable(TempestException):
104 message = "The server is not reachable via the configured network"
Jay Pipes051075a2012-04-28 17:39:37 -0400105
106
107class SQLException(TempestException):
108 message = "SQL error: %(message)s"