summaryrefslogtreecommitdiff
path: root/tempest/exceptions.py
diff options
context:
space:
mode:
authorAttila Fazekas <afazekas@redhat.com>2013-01-29 19:52:49 +0100
committerAttila Fazekas <afazekas@redhat.com>2013-01-29 19:52:49 +0100
commit965240332dd03036a785cce59e8e9c3d6adba300 (patch)
tree6315d923bfdc7e7a30982fbe16f4987f9a20b549 /tempest/exceptions.py
parentbe4150871d2c83f690d3ea4b4cd7c0c1fc8828f7 (diff)
downloadtempest-965240332dd03036a785cce59e8e9c3d6adba300.tar.gz
Derivate most of the RestClient's exception from the failureException
Hopefully it will help to mitigate the "catch exception and raise" a failureException type logic from the code. Change-Id: Ic1f9a35c2333238696d72a6038e6d47e47a7d889
Diffstat (limited to 'tempest/exceptions.py')
-rw-r--r--tempest/exceptions.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 178c2f20a..de22688f0 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -15,6 +15,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import unittest2 as unittest
+
class TempestException(Exception):
"""
@@ -27,6 +29,7 @@ class TempestException(Exception):
message = "An unknown exception occurred"
def __init__(self, *args, **kwargs):
+ super(TempestException, self).__init__()
try:
self._error_string = self.message % kwargs
except Exception:
@@ -49,11 +52,16 @@ class InvalidConfiguration(TempestException):
message = "Invalid Configuration"
-class NotFound(TempestException):
+class RestClientException(TempestException,
+ unittest.TestCase.failureException):
+ pass
+
+
+class NotFound(RestClientException):
message = "Object not found"
-class Unauthorized(TempestException):
+class Unauthorized(RestClientException):
message = 'Unauthorized'
@@ -78,11 +86,11 @@ class VolumeBuildErrorException(TempestException):
message = "Volume %(volume_id)s failed to build and is in ERROR status"
-class BadRequest(TempestException):
+class BadRequest(RestClientException):
message = "Bad request"
-class AuthenticationFailure(TempestException):
+class AuthenticationFailure(RestClientException):
message = ("Authentication with user %(user)s and password "
"%(password)s failed")
@@ -108,7 +116,7 @@ class IdentityError(TempestException):
message = "Got identity error"
-class Duplicate(TempestException):
+class Duplicate(RestClientException):
message = "An object with that identifier already exists"
@@ -135,7 +143,7 @@ class TearDownException(TempestException):
message = "%(num)d cleanUp operation failed"
-class RFCViolation(TempestException):
+class RFCViolation(RestClientException):
message = "RFC Violation"