Determine if the error means to retry or fail, True to retry.
7861
def should_try_kafka_again(error):
    """"""
    msg = 'Unable to retrieve'
    return isinstance(error, KafkaException) and str(error).startswith(msg)
843253
def temp_fail_retry(error, fun, *args):
    """"""
    while 1:
        try:
            return fun(*args)
        except error as e:
            eintr = errno.WSAEINTR if os.name == 'nt' else errno.EINTR
            if e.args[0] == eintr:
                continue
            raise
624944
def has_error(self):
        
        return next(
            (True for cr in self.component_results
             if cr.has_error()),
            False
        )
912455
async function retryPromise(fn, attempts, backoff) {
    let aborted = false;

    try {
        const data = await fn(() => { aborted = true; });
        return data;
    }
    catch (e) {
        if (aborted || ((backoff.attempts + 1) >= attempts)) {
            throw e;
        }

        const duration = backoff.duration();
        debug(`Promise rejected attempt #${backoff.attempts}, retrying in ${duration}ms: ${e.message}`);

        await Promise.delay(duration);
        return retryPromise(fn, attempts, backoff);
    }
}
528851
def failed(self):
        
        try:
            self._validate_parameters()
            self._base_delay = min(
                self._base_delay * self.exp_fac,
                self.delay_max)
            self._update_delay()
        except Exception:
            ic_logger.exception(
                'Unhandled exception trying to calculate a retry timout')
215910
function onError(err) {
    if (!retries.length) return reject(err);
    setTimeout(()=>fn().then(resolve, onError), retries.shift());
  }
568208
def _check_error(response):
        """"""
        if (not response.ok) or (response.status_code != 200):
            raise Exception(
                response.json()['error'] + ': ' +
                response.json()['error_description']
            )
1254657
def retry_on_excs(excs, retry_count=3, delay=5):
    

    def wrapper(f):
        @functools.wraps(f)
        def deco(*args, **kwargs):
            for i in range(0, retry_count):
                try:
                    return f(*args, **kwargs)
                except excs:
                    if logger:
                        logger.warning(
                            'HTTPError caught.Retrying ...'.format(f.__name__),
                            exc_info=True
                        )
                    time.sleep(delay)
            else:
                logger.error(
                    '{} failed after {} retries'.format(
                        f.__name__, retry_count)
                )
            return f(*args, **kwargs)

        return deco

    return wrapper
48771
def retry_until_true_or_limit_reached(method, limit, sleep_s=1,
                                      catch_exceptions=()):
  """"""
  return retry_until_valid_or_limit_reached(
      method, limit, lambda x: x, sleep_s, catch_exceptions)
23577
def on_error(self, e, pair):
        """"""
        RED = ansi_code("Fore.LIGHTRED_EX")
        R = ansi_code("Style.RESET_ALL")
        # any_entry = pair.any_entry
        write((RED + "ERROR: {}\n    {}" + R).format(e, pair))
        # Return True to ignore this error (instead of raising and terminating the app)
        if "[Errno 92] Illegal byte sequence" in "{}".format(e) and compat.PY2:
            write(RED + "This _may_ be solved by using Python 3." + R)
            # return True
        return False
314637
function retryOrError(){ 
					if (bRetrying)
						throw Error("unit hash verification failed, unit: "+unit+", objUnit: "+JSON.stringify(objUnit));
					console.log("unit hash verification failed, will retry");
					return setTimeout(function(){
						readJointDirectly(conn, unit, callbacks, true);
					}, 60*1000);
				}
955582
def _state_error(self, reason):
        
        log.err(reason)

        def matchException(failure):
            for errorState, backOff in self.backOffs.iteritems():
                if 'errorTypes' not in backOff:
                    continue
                if failure.check(*backOff['errorTypes']):
                    return errorState

            return 'other'

        errorState = matchException(reason)
        self._reconnect(errorState)
324861
def is_error(o):
    """"""
    if hasattr(o, 'error') and hasattr(o, 'error_description') and hasattr(o, 'status'):
        return True
    return False
709320
function (err, user, info) {
    if (err) {
      return self.error(err)
    }
    if (!user) {
      return self.fail(info)
    }
    self.success(user, info)
  }
661244
def is_successful(self, retry=False):
        

        if not self.is_terminated(retry=retry):
            return False
        retry_num = options.retry_times
        while retry_num > 0:
            try:
                statuses = self.get_task_statuses()
                return all(task.status == Instance.Task.TaskStatus.SUCCESS
                           for task in statuses.values())
            except (errors.InternalServerError, errors.RequestTimeTooSkewed):
                retry_num -= 1
                if not retry or retry_num <= 0:
                    raise
1088620
def fail(self, message, status=500, **kw):
        
        self.request.response.setStatus(status)
        result = {"success": False, "errors": message, "status": status}
        result.update(kw)
        return result
520807
def is_terminated(self, retry=False):
        
        retry_num = options.retry_times
        while retry_num > 0:
            try:
                return self.status == Instance.Status.TERMINATED
            except (errors.InternalServerError, errors.RequestTimeTooSkewed):
                retry_num -= 1
                if not retry or retry_num <= 0:
                    raise