You are here

public function Coroutine::_handleSuccess in Lockr 7.3

@internal

File

vendor/guzzlehttp/promises/src/Coroutine.php, line 118

Class

Coroutine
Creates a promise that is resolved using a generator that yields values or promises (somewhat similar to C#'s async keyword).

Namespace

GuzzleHttp\Promise

Code

public function _handleSuccess($value) {
  unset($this->currentPromise);
  try {
    $next = $this->generator
      ->send($value);
    if ($this->generator
      ->valid()) {
      $this
        ->nextCoroutine($next);
    }
    else {
      $this->result
        ->resolve($value);
    }
  } catch (Exception $exception) {
    $this->result
      ->reject($exception);
  } catch (Throwable $throwable) {
    $this->result
      ->reject($throwable);
  }
}