Automattic\WooCommerce\Vendor\GraphQL\Executor\Promise\Adapter

SyncPromise::rejectpublicWC 1.0

Method of the class: SyncPromise{}

No Hooks.

Returns

$this.

Usage

$SyncPromise = new SyncPromise();
$SyncPromise->reject( $reason ): self;
$reason(Throwable) (required)
.

SyncPromise::reject() code WC 10.9.1

public function reject(\Throwable $reason): self
{
    switch ($this->state) {
        case self::PENDING:
            $this->state = self::REJECTED;
            $this->result = $reason;
            $this->enqueueWaitingPromises();
            break;
        case self::REJECTED:
            if ($reason !== $this->result) {
                throw new \Exception('Cannot change rejection reason.');
            }

            break;
        case self::FULFILLED:
            throw new \Exception('Cannot reject fulfilled promise.');
    }

    return $this;
}