Changes exception's isinstance str to basestring
The error description was not being displayed when an exception was being raised. This was due to the patch merged in from issue #12 (reported in the 3PAR client), which changed the body to type bytes instead of typestr. The check in exceptions.py is now updated to represent this change. Change-Id: I471192a38b47f118114239fce63c52c9764b1ac9
This commit is contained in:
parent
970b2bf6a4
commit
b7eb87a397
@ -92,3 +92,5 @@ Changes in Version 2.0.1
|
||||
------------------------
|
||||
|
||||
* Allows suppressing of InsecureRequestWarning messages
|
||||
* Changes the exception isinstance check to look for basestring/str instead of
|
||||
bytes in order to properly store the error description.
|
||||
|
@ -24,6 +24,12 @@ Exceptions for the client
|
||||
the REST calls
|
||||
"""
|
||||
|
||||
# Python 3+ override
|
||||
try:
|
||||
basestring
|
||||
except NameError:
|
||||
basestring = str
|
||||
|
||||
|
||||
class UnsupportedVersion(Exception):
|
||||
"""
|
||||
@ -65,7 +71,7 @@ class ClientException(Exception):
|
||||
if not error:
|
||||
return
|
||||
|
||||
if isinstance(error, str):
|
||||
if isinstance(error, basestring):
|
||||
# instead of KeyError below, take it and make it the _error_desc.
|
||||
self._error_desc = error
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user