Kraken\Promise\PromiseRejected::then PHP Method

then() public method

public then ( callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null )
$onFulfilled callable
$onRejected callable
$onCancel callable
    public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onCancel = null)
    {
        if (null === $onRejected) {
            return $this;
        }
        try {
            return Promise::doResolve($onRejected($this->getReason()));
        } catch (Error $ex) {
            return new PromiseRejected($ex);
        } catch (Exception $ex) {
            return new PromiseRejected($ex);
        }
    }