You are here

public function Promise::otherwise in Zircon Profile 8.0

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

Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.

Parameters

callable $onRejected Invoked when the promise is rejected.:

Return value

PromiseInterface

Overrides PromiseInterface::otherwise

File

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

Class

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

Namespace

GuzzleHttp\Promise

Code

public function otherwise(callable $onRejected) {
  return $this
    ->then(null, $onRejected);
}