You are here

private function Promise::invokeWaitFn in Lockr 7.3

1 call to Promise::invokeWaitFn()
Promise::waitIfPending in vendor/guzzlehttp/promises/src/Promise.php

File

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

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;
    }
  }
}