1 # Copyright (c) 2018 Amdocs
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at:
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 class ClientException(Exception):
16 message = "ClientException"
18 def __init__(self, message=None):
19 self.message = message or self.message
20 super(ClientException, self).__init__(self.message)
23 class ServerException(Exception):
25 message = "ServerException"
27 def __init__(self, message=None, status_code="", content=""):
28 super(ServerException, self).__init__(message)
29 self.message = message or self.message
30 self.status_code = status_code
31 self.content = content
34 class RetriableConnectionFailure(Exception):
38 class ConnectionError(ClientException):
39 message = "Cannot connect to API service."
42 class ConnectTimeout(ConnectionError, RetriableConnectionFailure):
43 message = "Timed out connecting to service."
46 class ConnectFailure(ConnectionError, RetriableConnectionFailure):
47 message = "Connection failure that may be retried."
50 class SSLError(ConnectionError):
51 message = "An SSL error occurred."
54 class UnknownConnectionError(ConnectionError):
56 def __init__(self, msg, original):
57 super(UnknownConnectionError, self).__init__(msg)
58 self.original = original
61 class NotFoundError(ServerException):
62 message = "Cannot find value"
65 class VimDriverAzureException(ServerException):
66 message = "Cannot find vim driver"