What happens if I reject a Promise with another Promise value?
<p>If a <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" rel="nofollow noreferrer">Promise</a> <code>p</code> is resolved with the value of a Promise (or Thenable) <code>q</code>, it essentially becomes a copy of Promise <code>q</code>. If <code>q</code> is resolved, <code>p</code> will be resolved with the same value.</p>

<pre><code>Promise.resolve(Promise.resolve("hello"));
</code></pre>



<pre><code>Promise {[[PromiseStatus]]: "resolved", [[PromiseValue]]: "hello"}
</code></pre>

<p>If <code>q</code> is rejected, <code>p</code> will be rejected with the same value.</p>

<pre><code>Promise.resolve(Promise.reject(new Error("goodbye")));
</code></pre>



<pre><code>Promise {[[PromiseStatus]]: "rejected", [[PromiseValue]]: Error: goodbye}
</code></pre>

<p>The fact that Promise <code>p</code> was resolved/rejected through Promise <code>q</code>, instead of directly with the respective value, is irrelevant to the final result. The intermediate Promise is consumed as part of the resolution process, and is not visible to the consumer.</p>

<p>If <code>q</code> is a never resolved or rejected, <code>p</code> will also remain pending forever.</p>

<pre><code>Promise.resolve(new Promise(() =&gt; null)); // perpetually-pending promise
</code></pre>



<pre><code>Promise {[[PromiseStatus]]: "pending", [[PromiseValue]]: undefined}
</code></pre>

<p>These cases are well-known, but I have never seen what happens if a Promise is <em>rejected</em> (instead of resolved) with another Promise value. Does the rejection process also consume intermediate Promises, or are they passed through intact?</p>

<p>If it does consume them, how does that work?</p>