You are here

private function Promise::invokeWaitFn in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/promises/src/Promise.php \GuzzleHttp\Promise\Promise::invokeWaitFn()
1 call to Promise::invokeWaitFn()
Promise::waitIfPending in vendor/guzzlehttp/promises/src/Promise.php

File

vendor/guzzlehttp/promises/src/Promise.php, line 235

Class

Promise
Promises/A+ implementation that avoids recursion when possible.

Namespace

GuzzleHttp\Promise

Code

private function invokeWaitFn() {
  try {
    $wfn = $this->waitFn;
    $this->waitFn = null;
    $wfn(true);
  } catch (\Exception $reason) {
    if ($this->state === self::PENDING) {

      // The promise has not been resolved yet, so reject the promise
      // with the exception.
      $this
        ->reject($reason);
    }
    else {

      // The promise was already resolved, so there's a problem in
      // the application.
      throw $reason;
    }
  }
}