def _get_error(self, status_code, response=None):
        try:
            headers = response.headers
        except __HOLE__:
            headers = {}
        try:
            text = response.text
        except (AttributeError, TypeError):
            text = ""       

        if response:
            url = response.url
        else:
            url = None

        # analytics.track("CORE", "Received error response from Provider", {
        #     "provider": self.provider_name, 
        #     "url": url,
        #     "text": text,
        #     "status_code": status_code
        #     })

        if status_code >= 500:
            error = ProviderServerError(response)
            self.logger.info(u"%s ProviderServerError status code=%i, %s, %s" 
                % (self.provider_name, status_code, text, str(headers)))
        else:
            error = ProviderClientError(response)
            self.logger.info(u"%s ProviderClientError status code=%i, %s, %s" 
                % (self.provider_name, status_code, text, str(headers)))

        raise(error)
        return error
dataset/ETHPy150Open Impactstory/total-impact-webapp/totalimpact/providers/provider.py/Provider._get_error