<p dir="auto">If I use the new <code class="notranslate">cause</code> property and throw an Error in a <code class="notranslate">.ts</code> file it doesn't show the expected output when using <code class="notranslate">deno run</code></p>
<p dir="auto">code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="throw new Error(&quot;main error&quot;, { cause: new TypeError(&quot;caused by this&quot;) });"><pre class="notranslate"><code class="notranslate">throw new Error("main error", { cause: new TypeError("caused by this") });
</code></pre></div>
<p dir="auto">expected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Uncaught Error: main error
    at &lt;anonymous&gt;:2:7
Caused by TypeError: caused by this
    at &lt;anonymous&gt;:3:12"><pre class="notranslate"><code class="notranslate">Uncaught Error: main error
    at &lt;anonymous&gt;:2:7
Caused by TypeError: caused by this
    at &lt;anonymous&gt;:3:12
</code></pre></div>
<p dir="auto">actual:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Uncaught Error: main error
throw new Error(&quot;main error&quot;, { cause: new TypeError(&quot;caused by this&quot;) });
      ^
    at file:///path/to/my/file.ts:1:7"><pre class="notranslate"><code class="notranslate">error: Uncaught Error: main error
throw new Error("main error", { cause: new TypeError("caused by this") });
      ^
    at file:///path/to/my/file.ts:1:7
</code></pre></div>
<p dir="auto">It does work if I <code class="notranslate">console.log</code> the error or if I <code class="notranslate">throw</code> one using the REPL though.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="deno --version

deno 1.16.0 (release, x86_64-unknown-linux-gnu)
v8 9.7.106.2
typescript 4.4.2"><pre class="notranslate"><code class="notranslate">deno --version

deno 1.16.0 (release, x86_64-unknown-linux-gnu)
v8 9.7.106.2
typescript 4.4.2
</code></pre></div>
<p dir="auto">Since Deno 1.13.0, Error Cause Proposal is supported, so the <code class="notranslate">Error</code> object can hold inner errors. However, their contents are usually not displayed and I need to explicitly access the <code class="notranslate">cause</code> property.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="function bar() {
  throw new Error(&quot;bar&quot;);
}

function foo() {
  try {
    bar();
  } catch (e) {
    throw new Error(&quot;foo&quot;, { cause: e });
  }
}

foo();"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-v">Error</span><span class="pl-kos">(</span><span class="pl-s">"bar"</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>

<span class="pl-k">function</span> <span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
  <span class="pl-k">try</span> <span class="pl-kos">{</span>
    <span class="pl-en">bar</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span> <span class="pl-k">catch</span> <span class="pl-kos">(</span><span class="pl-s1">e</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">throw</span> <span class="pl-k">new</span> <span class="pl-v">Error</span><span class="pl-kos">(</span><span class="pl-s">"foo"</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> <span class="pl-c1">cause</span>: <span class="pl-s1">e</span> <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-kos">}</span>
<span class="pl-kos">}</span>

<span class="pl-en">foo</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2622837/135757916-44ea1fd0-8f35-43fd-aa43-678dc466fc24.png"><img width="448" alt="terminal" src="https://user-images.githubusercontent.com/2622837/135757916-44ea1fd0-8f35-43fd-aa43-678dc466fc24.png" style="max-width: 100%;"></a></p>
<p dir="auto">I think it should also show inner errors, just like Firefox does.</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/2622837/135758170-4d4f379f-3e56-4ce6-b5a6-1c59a8cd9094.png"><img width="316" alt="Firefox console" src="https://user-images.githubusercontent.com/2622837/135758170-4d4f379f-3e56-4ce6-b5a6-1c59a8cd9094.png" style="max-width: 100%;"></a></p>