def parse_body(self):
        body = super(CloudFlareDNSResponse, self).parse_body()
        body = body or {}

        result = body.get('result', None)
        error_code = body.get('err_code', None)
        msg = body.get('msg', None)
        is_error_result = result == 'error'

        context = self.connection.context or {}
        context_record_id = context.get('record_id', None)
        context_zone_domain = context.get('zone_domain', None)

        if (is_error_result and 'invalid record id' in msg.lower() and
                context_record_id):
            raise RecordDoesNotExistError(value=msg,
                                          driver=self.connection.driver,
                                          record_id=context_record_id)
        elif (is_error_result and 'invalid zone' in msg.lower() and
              context_zone_domain):
            raise ZoneDoesNotExistError(value=msg,
                                        driver=self.connection.driver,
                                        zone_id=context_zone_domain)

        if error_code == 'E_UNAUTH':
            raise InvalidCredsError(msg)
        elif result == 'error' or error_code is not None:
            msg = 'Request failed: %s' % (self.body)
            raise LibcloudError(value=msg, driver=self.connection.driver)

        return body
dataset/ETHPy150Open apache/libcloud/libcloud/dns/drivers/cloudflare.py/CloudFlareDNSResponse.parse_body/original