Helper method to determine if the proxies logged any major errors related to the functioning of the proxy itself
178061
def check_no_proxy_errors(self, **kwargs):
        
        data = self._es.search(body={
            "size": max_query_results,
            "query": {
                "filtered": {
                    "query": {
                        "match_all": {}
                    },
                    "filter": {
                        "term": {
                            "level": "error"
                        }
                    }
                }
            }
        })
#        if self.debug:
#            print(data)
        return GremlinTestResult(data["hits"]["total"] == 0, data)
792619
def host_errors(self, hostname, details):
        
        if not hostname or not isinstance(hostname, basestring):
            return "hostname_invalid"
        if not isinstance(details, list):
            return "host_details_not_list"
        if len(details) != 3:
            return "host_details_wrong_length"
        if details[0] not in self.balancer.action_mapping:
            return "host_action_invalid:%s" % details[0]
        if not isinstance(details[1], dict):
            return "host_kwargs_not_dict"
        if not isinstance(details[2], bool):
            return "host_match_subdomains_not_bool"
        return None
1311016
function proxy() {
  const defaultProxy = {
    changeOrigin: true,
    ws: true,
    logLevel: 'info',
    xfwd: true,
    logProvider() {
      return {
        log(...args) {
          Logger.log(proxyLogRewrite(args));
        },
        debug(...args) {
          Logger.debug(proxyLogRewrite(args));
        },
        info(...args) {
          Logger.info(proxyLogRewrite(args));
        },
        warn(...args) {
          Logger.warn(proxyLogRewrite(args));
        },
        error(...args) {
          Logger.error(proxyLogRewrite(args));
        }
      };
    }
  };

  const { proxies } = settings.configuration;

  if (!proxies) {
    return null;
  }

  const config = [];

  // Iterate through each proxy configuration
  proxies.forEach(proxyConfiguration => {
    // Merge in defaults including custom Logger and custom request/response function
    const proxyConfig = merge({}, defaultProxy, proxyConfiguration, {
      onProxyReq: (proxyReq, req) => {
        onRequest(proxyConfiguration, proxyReq, req);
        if (typeof proxyConfiguration.onProxyReq === 'function') {
          proxyConfiguration.onProxyReq(proxyReq, req);
        }
      },

      onProxyRes: (proxyRes, req, res) => {
        onResponse(proxyConfiguration, proxyRes, req, res);
        if (typeof proxyConfiguration.onProxyRes === 'function') {
          proxyConfiguration.onProxyRes(proxyRes, req, res);
        }
      },

      onError: (err, req, res) => {
        onProxyError(proxyConfiguration, err, req, res);
        if (typeof proxyConfiguration.onError === 'function') {
          proxyConfiguration.onError(err, req, res);
        }
      }
    });

    const proxyContext = Array.isArray(proxyConfig.context) ? proxyConfig.context[0] : proxyConfig.context;

    // Only create proxy if enabled
    if (proxyConfig.enabled) {
      config.push(proxyConfig);
    } else {
      Logger.info(
        `Proxy with context: ${chalk.dim(proxyContext)} and target: ${chalk.dim(proxyConfig.target)} is ${chalk.magenta(
          'DISABLED'
        )}`
      );
    }
  });

  // return null if the array is 0 to make the checks easier upstream
  return config.length === 0 ? null : config;
}
188546
function logHttpRequestError (uniqueId, err) {
    // require log client
    if (!logClient) {
        return
    }
    // log error
    logClient.log('httpRequestError', {
        httpRequestId: uniqueId.id,
        httpRequestErrorCreateTime: microTimestamp(),
        httpRequestError: err.message,
    })
}
988618
def mark_dead(self, proxy, _time=None):
        
        if proxy not in self.proxies:
            logger.warn("Proxy <%s> was not found in proxies list" % proxy)
            return

        if proxy in self.good:
            logger.debug("GOOD proxy became DEAD: <%s>" % proxy)
        else:
            logger.debug("Proxy <%s> is DEAD" % proxy)

        self.unchecked.discard(proxy)
        self.good.discard(proxy)
        self.dead.add(proxy)

        now = _time or time.time()
        state = self.proxies[proxy]
        state.backoff_time = self.backoff(state.failed_attempts)
        state.next_check = now + state.backoff_time
        state.failed_attempts += 1
449425
def _should_proxy(self, attr):
        
        if attr in type(self).__notproxied__:
            return False
        if _oga(self, "__notproxied__") is True:
            return False
        return True
895027
public function checkForFatalErrors() {
		// in case of memory size exhausted error
		gc_collect_cycles();
// 		$this->checkForPendingLogExceptions();
		
		$error = error_get_last();
		
		if (!isset($error) || $this->checkForError($error['type'], $error['file'], $error['line'], $error['message'])) {
			return;
		}
				
// 		if ($error['type'] == E_WARNING && substr($error['message'], 0, 23) == 'DateTime::__construct()') {
// 			return;
// 		}
		
// 		if (!$this->strictAttitude || ($error['type'] & self::STRICT_ATTITUTE_PHP_SEVERITIES)) {
// 			return;
// 		}
		
		try {
			$this->handleTriggeredError($error['type'], $error['message'], $error['file'], $error['line'], null, true);
		} catch (\Throwable $e) {
			$this->dispatchException($e);
		}

		$this->checkForPendingLogExceptions();
	}
223376
function(err, docs) {
        if (err) {
            /* Failed to get proxy from db */
            console.log(err);
            callback(err);
            return;
        }

        if (docs !== null && docs.length >= 1) {
            callback(null, docs);
        } else {
            var errorMessage = "No proxy that matches the criteria";
            var err = new Error(errorMessage);
            console.log(errorMessage);
            callback(err);
        }
    }
648377
def is_error(self):
        
        qstat = self._grep_qstat('error')
        err = self._grep_status('error')
        if qstat and err:
            return True
        return False
521119
def handleError(self, record):
        '''
        
        '''
        handled = False
        if sys.stderr and sys.version_info >= (3, 5, 4):
            t, v, tb = sys.exc_info()
            if t.__name__ in 'FileNotFoundError':
                sys.stderr.write('[WARNING ] The log_file does not exist. Logging not setup correctly or syslog service not started.\n')
                handled = True

        if not handled:
            super(SysLogHandler, self).handleError(record)
1313979
protected void evaluateProxiedServiceIfNeeded(final Service service, final TicketGrantingTicket ticketGrantingTicket, final RegisteredService registeredService) {
        val proxiedBy = ticketGrantingTicket.getProxiedBy();
        if (proxiedBy != null) {
            LOGGER.debug("Ticket-granting ticket is proxied by [{}]. Locating proxy service in registry...", proxiedBy.getId());
            val proxyingService = this.servicesManager.findServiceBy(proxiedBy);
            if (proxyingService != null) {
                LOGGER.debug("Located proxying service [{}] in the service registry", proxyingService);
                if (!proxyingService.getProxyPolicy().isAllowedToProxy()) {
                    LOGGER.warn("Found proxying service [{}], but it is not authorized to fulfill the proxy attempt made by [{}]", proxyingService.getId(), service.getId());
                    throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId());
                }
            } else {
                LOGGER.warn("No proxying service found. Proxy attempt by service [{}] (registered service [{}]) is not allowed.", service.getId(), registeredService.getId());
                throw new UnauthorizedProxyingException(UnauthorizedProxyingException.MESSAGE + registeredService.getId());
            }
        } else {
            LOGGER.trace("Ticket-granting ticket is not proxied by another service");
        }
    }
331166
function logError(e) {
		e = e instanceof Error ? e : e ? new Error(e) : null;
		if (e) {
			if (options && util.isRegExp(options.hideTokenRegExp)) {
				e.message = e.message.replace(options.hideTokenRegExp, function(match, prefix, token, suffix) {
					return prefix + '[SECURE]' + suffix;
				});
			}
			errors.unshift(e);
			rbot.log.error(e.stack || e.message);
		}
	}
478222
def check(self):
        
        parser = get_parser(self.scheduler_adapter.name, err_file=self.err_file, out_file=self.out_file,
                            run_err_file=self.run_err_file, batch_err_file=self.batch_err_file)
        parser.parse()
        self.errors = parser.errors
        if len(self.errors) == 0:
            return False
        else:
            return True
393583
function (cb) {
                if (_.isFunction(_.get(proxies, 'resolve'))) {
                    return cb(null, proxies.resolve(url));
                }

                return cb(null, undefined);
            }
1083649
private void checkForFailure(FilterJoinNode node) {
    if (node.hasFailure()) {
      logger.error("Node processing failed: {}", node.getFailure());
      throw new ElasticsearchException("Unexpected failure while processing a node", node.getFailure());
    }
  }
848036
def is_connection_error(e):
    
    return (isinstance(e, err.InterfaceError) and e.args[0] == "(0, '')") or\
        (isinstance(e, err.OperationalError) and e.args[0] in operation_error_codes.values())
827258
def should_bypass_proxies(url, no_proxy):
    
    # Prioritize lowercase environment variables over uppercase
    # to keep a consistent behaviour with other http projects (curl, wget).
    get_proxy = lambda k: os.environ.get(k) or os.environ.get(k.upper())

    # First check whether no_proxy is defined. If it is, check that the URL
    # we're getting isn't in the no_proxy list.
    no_proxy_arg = no_proxy
    if no_proxy is None:
        no_proxy = get_proxy('no_proxy')
    parsed = urlparse(url)

    if parsed.hostname is None:
        # URLs don't always have hostnames, e.g. file:/// urls.
        return True

    if no_proxy:
        # We need to check whether we match here. We need to see if we match
        # the end of the hostname, both with and without the port.
        no_proxy = (
            host for host in no_proxy.replace(' ', '').split(',') if host
        )

        if is_ipv4_address(parsed.hostname):
            for proxy_ip in no_proxy:
                if is_valid_cidr(proxy_ip):
                    if address_in_network(parsed.hostname, proxy_ip):
                        return True
                elif parsed.hostname == proxy_ip:
                    # If no_proxy ip was defined in plain IP notation instead of cidr notation &
                    # matches the IP of the index
                    return True
        else:
            host_with_port = parsed.hostname
            if parsed.port:
                host_with_port += ':{}'.format(parsed.port)

            for host in no_proxy:
                if parsed.hostname.endswith(host) or host_with_port.endswith(host):
                    # The URL does match something in no_proxy, so we don't want
                    # to apply the proxies on this URL.
                    return True

    with set_environ('no_proxy', no_proxy_arg):
        # parsed.hostname can be `None` in cases such as a file URI.
        try:
            bypass = proxy_bypass(parsed.hostname)
        except (TypeError, socket.gaierror):
            bypass = False

    if bypass:
        return True

    return False