def handle_errors(self, httpCode, reason, url, method, headers, body):
    if (not isinstance(body, basestring)):
        return
    if (len(body) < 2):
        return
    if ((body[0] == '{') or (body[0] == '[')):
        response = json.loads(body)
        error = self.safe_value(response, 'error')
        errors = self.safe_value(response, 'errors')
        data = self.safe_value(response, 'data')
        if ((error is not None) or (errors is not None) or (data is None)):
            feedback = ((self.id + ' ') + self.json(response))
            code = None
            if (error is not None):
                code = self.safe_integer(error, 'code')
            exceptions = self.exceptions['codes']
            if (errors is not None):
                if self.isArray(errors):
                    code = self.safe_string(errors[0], 'code')
                else:
                    code = self.safe_string(errors, 'detail')
                    exceptions = self.exceptions['detail']
            if (code in exceptions):
                raise exceptions[code](feedback)
            else:
                raise ExchangeError(feedback)
def handle_errors(self, httpCode, reason, url, method, headers, body):
    if (not isinstance(body, basestring)):
        return
    if (len(body) < 2):
        return
    if ((body[0] == '{') or (body[0] == '[')):
        response = json.loads(body)
        error = self.safe_value(response, 'error')
        errors = self.safe_value(response, 'errors')
        data = self.safe_value(response, 'data')
        if ((error is not None) or (errors is not None) or (data is None)):
            feedback = ((self.id + ' ') + self.json(response))
            code = None
            if (error is not None):
                code = self.safe_integer(error, 'code')
            exceptions = self.exceptions['codes']
            if (errors is not None):
                if self.isArray(errors):
                    code = self.safe_string(errors[0], 'code')
                else:
                    code = self.safe_string(errors, 'detail')
                    exceptions = self.exceptions['detail']
            if (code in exceptions):
                raise exceptions[code](feedback)
            else:
                raise ExchangeError(feedback)