1# Licensed under the Apache License, Version 2.0 (the "License"); you may 2# not use this file except in compliance with the License. You may obtain 3# a copy of the License at 4# 5# http://www.apache.org/licenses/LICENSE-2.0 6# 7# Unless required by applicable law or agreed to in writing, software 8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 10# License for the specific language governing permissions and limitations 11# under the License. 12 13from keystoneauth1.exceptions import base 14 15 16__all__ = ('ConnectionError', 17 'ConnectTimeout', 18 'ConnectFailure', 19 'SSLError', 20 'RetriableConnectionFailure', 21 'UnknownConnectionError') 22 23 24class RetriableConnectionFailure(Exception): 25 """A mixin class that implies you can retry the most recent request.""" 26 27 pass 28 29 30class ConnectionError(base.ClientException): 31 message = "Cannot connect to API service." 32 33 34class ConnectTimeout(ConnectionError, RetriableConnectionFailure): 35 message = "Timed out connecting to service." 36 37 38class ConnectFailure(ConnectionError, RetriableConnectionFailure): 39 message = "Connection failure that may be retried." 40 41 42class SSLError(ConnectionError): 43 message = "An SSL error occurred." 44 45 46class UnknownConnectionError(ConnectionError): 47 """An error was encountered but we don't know what it is.""" 48 49 def __init__(self, msg, original): 50 super(UnknownConnectionError, self).__init__(msg) 51 self.original = original 52