Convert exception to string before passing it in
Before this change, neutronclient was passing in a raw exception as a kwarg to the ConnectionFailed exception. This caused an exception to be raised in _safe_decode_dict() due to the exception not being a text type. Now, we explicitly convert the raw exception to a string before passing it as a kwarg. Closes-bug: 1859068 Change-Id: I323b3aceec0a937874eabf770fbc82995202f6d6
This commit is contained in:
parent
a363edd761
commit
946ac3ed2e
@ -104,13 +104,13 @@ class HTTPClient(object):
|
|||||||
try:
|
try:
|
||||||
resp, body = self.request(*args, **kargs)
|
resp, body = self.request(*args, **kargs)
|
||||||
except requests.exceptions.SSLError as e:
|
except requests.exceptions.SSLError as e:
|
||||||
raise exceptions.SslCertificateValidationError(reason=e)
|
raise exceptions.SslCertificateValidationError(reason=str(e))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# Wrap the low-level connection error (socket timeout, redirect
|
# Wrap the low-level connection error (socket timeout, redirect
|
||||||
# limit, decompression error, etc) into our custom high-level
|
# limit, decompression error, etc) into our custom high-level
|
||||||
# connection exception (it is excepted in the upper layers of code)
|
# connection exception (it is excepted in the upper layers of code)
|
||||||
_logger.debug("throwing ConnectionFailed : %s", e)
|
_logger.debug("throwing ConnectionFailed : %s", e)
|
||||||
raise exceptions.ConnectionFailed(reason=e)
|
raise exceptions.ConnectionFailed(reason=str(e))
|
||||||
utils.http_log_resp(_logger, resp, body)
|
utils.http_log_resp(_logger, resp, body)
|
||||||
|
|
||||||
# log request-id for each api call
|
# log request-id for each api call
|
||||||
|
Loading…
x
Reference in New Issue
Block a user