Icicle\Awaitable\Internal\RejectedAwaitable::then PHP Method

then() public method

public then ( callable $onFulfilled = null, callable $onRejected = null ) : Icicle\Awaitable\Awaitable
$onFulfilled callable
$onRejected callable
return Icicle\Awaitable\Awaitable
    public function then(callable $onFulfilled = null, callable $onRejected = null) : Awaitable
    {
        if (null === $onRejected) {
            return $this;
        }
        try {
            $result = $onRejected($this->exception);
        } catch (Throwable $exception) {
            return new self($exception);
        }
        if (!$result instanceof Awaitable) {
            $result = new FulfilledAwaitable($result);
        }
        return $result;
    }