title: How to rethrow preserving stacktrace in Safari? Safari doesn't show entire stacktrace
body: <p>When I rethrow an error, Safari 14.0.3 on macOS Big Sur doesn't print the entire (original) stacktrace. Instead it just points at the rethrow line.</p>
  <p>Minimum reproducible example:</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  function one() {
    two();
  }
  
  function two() {
    three();
  }
  
  function three() {
    throw new Error('error from three');
  }
  
  try {
    one();
  } catch (e) {
    console.log(e);
    throw e;
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Running this in my browser Safari 14 prints</p>
  <p><a href="https://i.stack.imgur.com/bpheO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bpheO.png" alt="enter image description here" /></a></p>
  <p>The <em>actual</em>  error in the console from the line 21 rethrow,  <code>throw e;</code>, only has a one-line stacktrace, pointing at this throw statement on line 21.</p>
  <p>The real stacktrace is proven to exist on the error <code>e</code> by the log above, <code>console.log(e)</code> shows an entire stacktrace from <code>one()</code> to <code>two()</code> to <code>three()</code> to line 14 <code>throw new Error...</code></p>
  <p>This seems to be a Safari-only issue, none of Chrome, Firefox, nor Node.js have this problem.</p>
  <p>Why doesn't Safari show the entire stacktrace of the rethrown error? How can I force it to do so?</p>
  <p>In my in-development website I am doing a couple times:</p>
  <pre><code>try {
    coinToss();
  } catch (e) {
    visuallyPresentErrorInWebpage(e);
    throw e;
  }
  </code></pre>
  <p>I would <em>love</em>  for the browser to automatically show me e's full stacktrace, how can I force it do that?</p>
  <pre><code>} catch (e) {
    visuallyPresentErrorInWebpage(e);
    console.error(e);
    throw e;
  }
  </code></pre>
  <p>Is not ideal because now I have duplicated information in the console to slough through.</p>