You are here

public function Coroutine::_handleFailure in Lockr 7.3

@internal

File

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

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 _handleFailure($reason) {
  unset($this->currentPromise);
  try {
    $nextYield = $this->generator
      ->throw(exception_for($reason));

    // The throw was caught, so keep iterating on the coroutine
    $this
      ->nextCoroutine($nextYield);
  } catch (Exception $exception) {
    $this->result
      ->reject($exception);
  } catch (Throwable $throwable) {
    $this->result
      ->reject($throwable);
  }
}