def parse_error(self):
        if self.status == httplib.UNAUTHORIZED:
            raise InvalidCredsError('Invalid provider credentials')

        body = self.parse_body()

        if isinstance(body, basestring):
            return body + ' (HTTP Code: %d)' % self.status

        error = body.get('error', None)
        debug = body.get('debug', None)
        # If we only have one of "error" or "debug", use the one that we have.
        # If we have both, use both, with a space character in between them.
        value = 'No message specified'
        if error is not None:
            value = error
        if debug is not None:
            value = debug
        if error is not None and value is not None:
            value = error + ' ' + value
        value = value + ' (HTTP Code: %d)' % self.status

        return value
dataset/ETHPy150Open apache/libcloud/libcloud/common/nfsn.py/NFSNResponse.parse_error/original