Raises an exception in wait()

        :param exception: An Exception object
321221
def raise_exception(self, exception):
        
        self.__data = None
        self.__exception = exception
        self.__event.set()
922718
def wait(self, timeout=None):
        
        try:
            if timeout:
                gevent.sleep(timeout)
            else:
                while True:
                    gevent.sleep(1000)
        except (KeyboardInterrupt, SystemExit, Exception):
            pass
1275641
async def handle_exception(self, exc: Exception, action: str, request_id):
        
        if isinstance(exc, APIException):
            await self.reply(
                action=action,
                errors=self._format_errors(exc.detail),
                status=exc.status_code,
                request_id=request_id
            )
        elif exc == Http404 or isinstance(exc, Http404):
            await self.reply(
                action=action,
                errors=self._format_errors('Not found'),
                status=404,
                request_id=request_id
            )
        else:
            raise exc
216517
public void waitDone() throws ResponseTimeoutException,
            InvalidResponseException {
        lock.lock();
        try {
            if (!isDoneResponse()) {
                try {
                    condition.await(timeout, TimeUnit.MILLISECONDS);
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new RuntimeException("Interrupted");
                }
            }
            
            if (illegalResponseException != null) {
                throw illegalResponseException;
            }
            
            if (!isDoneResponse()) {
                throw new ResponseTimeoutException("No response after " + timeout
                        + " millis");
            }
        } finally {
            lock.unlock();
        }
    }
1037795
def exception_set(self, exception=None):
        
        if not exception:
            exception = sys.exc_info()
        self.exception = exception
        self.exception_raise = self._exception_raise
964489
def wait(timeout = nil)
      raise ConditionError, "cannot wait for signals while exclusive" if Celluloid.exclusive?

      if actor = Thread.current[:celluloid_actor]
        task = Task.current
        if timeout
          bt = caller
          timer = actor.timers.after(timeout) do
            exception = ConditionError.new("timeout after #{timeout.inspect} seconds")
            exception.set_backtrace bt
            task.resume exception
          end
        end
      else
        task = Thread.current
      end
      waiter = Waiter.new(self, task, Celluloid.mailbox, timeout)

      @mutex.synchronize do
        @waiters << waiter
      end

      result = Celluloid.suspend :condwait, waiter
      timer.cancel if timer
      raise result if result.is_a?(ConditionError)
      return yield(result) if block_given?
      result
    end
946642
def set_exception(self, exception):
        
        assert isinstance(exception, Exception), \
            "%r should be an Exception" % exception
        self._exception = exception
        self._state = self.FINISHED
145859
public void waitUntilFinish() {
        while (!finished) {
            synchronized (waitingLock) {
                if (config.isHaltOnError()) {
                    Throwable t = getError();
                    if (t != null && config.isHaltOnError()) {
                        if (t instanceof RuntimeException) {
                            throw (RuntimeException)t;
                        } else if (t instanceof Error) {
                            throw (Error)t;
                        } else {
                            throw new RuntimeException("error on monitor thread", t);
                        }
                    }
                }
                if (finished) {
                    return;
                }
                try {
                    waitingLock.wait();
                } catch (InterruptedException e) {
                    logger.error("Error occurred", e);
                }
            }
        }
    }
1355471
def example_exc_handler(tries_remaining, exception, delay):
    
    print >> sys.stderr, "Caught '%s', %d tries remaining, sleeping for %s seconds" % (
        exception, tries_remaining, delay)
1113897
def wait_for_fun(fun, timeout=900, **kwargs):
    '''
    
    '''
    start = time.time()
    log.debug('Attempting function %s', fun)
    trycount = 0
    while True:
        trycount += 1
        try:
            response = fun(**kwargs)
            if not isinstance(response, bool):
                return response
        except Exception as exc:
            log.debug('Caught exception in wait_for_fun: %s', exc)
            time.sleep(1)
            log.debug('Retrying function %s on  (try %s)', fun, trycount)
        if time.time() - start > timeout:
            log.error('Function timed out: %s', timeout)
            return False
1067704
def wait_while(self, condition, *args, **kw):
    
    return self.wait_for(lambda: not condition(), *args, **kw)
117188
def notify_exception(self, exception, run_done_callbacks=True):
        '''  '''
        logger.error("%s : %s" % (exception.__class__.__name__, str(exception)))
        self._exception = exception
        if self.is_running(True):
            # wait for a short 5 seconds for it to finish
            for _cnt in range(0, 5):
                if not self._cancel():
                    time.sleep(1)
                else:
                    break

        self.notify_done(error=True, run_done_callbacks=run_done_callbacks)
335207
def thread_exception(self, raised_exception):
		
		print('Thread execution was stopped by the exception. Exception: %s' % str(raised_exception))
		print('Traceback:')
		print(traceback.format_exc())
1140974
def wait(self, timeout=0):
        
        start_time = time.time()

        # We return synchronously, so we block in a busy loop waiting for the
        # request to be done.
        while not self.is_done:
            duration = time.time() - start_time
            if timeout and duration > timeout:
                raise CloudTimeoutError(
                    "Timeout getting async value. Timeout: %d seconds" % timeout
                )
            time.sleep(0.1)

        # If we get an any status code other than a 2xx we raise an exception to the user, which can then be handled
        # accordingly.
        status_code, error_msg, payload = self.check_error()
        if not self._status_ok(status_code):
            raise CloudAsyncError("Async response for '%s' returned an error." % self.async_id,
                                  reason=error_msg,
                                  status=status_code)

        value = self.value
        if isinstance(value, six.binary_type):
            value = value.decode('utf-8')
        return value
992282
def _handle_client_exception():
    
    try:
        yield

    except _ClientException as exception:
        if exception.http_status in _ERROR_CODES:
            raise _ERROR_CODES[exception.http_status](
                exception.http_reason)
        raise
1043730
private static void wait(Object lock, int timeout)
  {
    try {
      lock.wait(timeout);
    }
    catch(InterruptedException unused) {
      Thread.currentThread().interrupt();
    }
  }
1003889
public Predicate<Exception> raise(Class<? extends Exception> exception) {
    return create(error -> error != null && exception.isAssignableFrom(error.getClass()));
  }