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:
Alex O'Rourke 2015-10-26 15:09:39 -07:00 committed by Kurt Martin
parent 970b2bf6a4
commit b7eb87a397
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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: