diff options
author | 2016-01-29 16:00:57 -0800 | |
---|---|---|
committer | 2016-01-29 16:00:57 -0800 | |
commit | 82f1a7eb5535b30a95b1e71ff18c315d40d1e6f0 (patch) | |
tree | f930c90f75846ec8d8e33cf27325ff8fafc85d5c /Testcases/vnc_api/common/exceptions.py | |
parent | 5c04f2e22eb6b5e7a671bc02ba53a438eb66e90d (diff) |
OpenContrail test suitestable/colorado
Change-Id: I61168093a2a05d47377ef47c8638ae1554b1a999
Signed-off-by: Stuart Mackie <wsmackie@juniper.net>
Diffstat (limited to 'Testcases/vnc_api/common/exceptions.py')
-rw-r--r-- | Testcases/vnc_api/common/exceptions.py | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/Testcases/vnc_api/common/exceptions.py b/Testcases/vnc_api/common/exceptions.py new file mode 100644 index 0000000..d9723a4 --- /dev/null +++ b/Testcases/vnc_api/common/exceptions.py @@ -0,0 +1,133 @@ +# +# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. +# +# Base class of all exceptions in VNC + + +class VncError(Exception): + pass +# end class VncError + +class ServiceUnavailableError(VncError): + def __init__(self, code): + self._reason_code = code + # end __init__ + + def __str__(self): + return 'Service unavailable time out due to: %s' % (str(self._reason_code)) + # end __str__ +# end class ServiceUnavailableError + +class TimeOutError(VncError): + def __init__(self, code): + self._reason_code = code + # end __init__ + + def __str__(self): + return 'Timed out due to: %s' % (str(self._reason_code)) + # end __str__ +# end class TimeOutError + + +class BadRequest(Exception): + def __init__(self, status_code, content): + self.status_code = status_code + self.content = content + # end __init__ + + def __str__(self): + return 'HTTP Status: %s Content: %s' % (self.status_code, self.content) + # end __str__ +# end class BadRequest + + +class NoIdError(VncError): + + def __init__(self, unknown_id): + self._unknown_id = unknown_id + # end __init__ + + def __str__(self): + return 'Unknown id: %s' % (self._unknown_id) + # end __str__ +# end class NoIdError + + +class MaxRabbitPendingError(VncError): + + def __init__(self, npending): + self._npending = npending + # end __init__ + + def __str__(self): + return 'Too many pending updates to RabbitMQ: %s' % (self._npending) + # end __str__ +# end class MaxRabbitPendingError + +class ResourceExistsError(VncError): + def __init__(self, eexists_fq_name, eexists_id): + self._eexists_fq_name = eexists_fq_name + self._eexists_id = eexists_id + # end __init__ + + def __str__(self): + return 'FQ Name: %s exists already with ID: %s' \ + % (self._eexists_fq_name, self._eexists_id) + # end __str__ +# end class ResourceExistsError + +class ResourceTypeUnknownError(VncError): + def __init__(self, obj_type): + self._unknown_type = obj_type + # end __init__ + + def __str__(self): + return 'Unknown object type: %s' %(self._unknown_type) + # end __str__ +# end class ResourceTypeUnknownError + +class PermissionDenied(VncError): + pass +# end class PermissionDenied + + +class RefsExistError(VncError): + pass +# end class RefsExistError + + +class ResourceExhaustionError(VncError): + pass +# end class ResourceExhaustionError + + +class NoUserAgentKey(VncError): + pass +# end class NoUserAgentKey + + +class UnknownAuthMethod(VncError): + pass +# end class UnknownAuthMethod + + +class HttpError(VncError): + + def __init__(self, status_code, content): + self.status_code = status_code + self.content = content + # end __init__ + + def __str__(self): + return 'HTTP Status: %s Content: %s' % (self.status_code, self.content) + # end __str__ +# end class HttpError + + +class AmbiguousParentError(VncError): + pass + + +class InvalidSessionID(VncError): + pass +# end InvalidSessionID |