public function reject(ClientExceptionInterface $exception): void
    {
        if (Promise::PENDING !== $this->state) {
            return;
        }

        $this->failure = $exception;
        $this->state = Promise::REJECTED;

        foreach ($this->onRejectedCallbacks as $onRejectedCallback) {
            $onRejectedCallback($exception);
        }
    }