<p dir="auto">Error 'IO error: Broken pipe (os error 32)' contains boxed error of unknown type:<br>
Io(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })<br>
Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }<br>
error: Uncaught (in promise) Error: IO error: Broken pipe (os error 32): Broken pipe (os error 32)<br>
at async deno:ext/websocket/01_websocket.js:514:13</p>
<p dir="auto">This situation can happen, but maybe there is a better way to handle it than crashing the whole server.</p>
<p dir="auto">[Using Deno 1.28.0]</p>
<p dir="auto">I frequently have the following exception that kills my program:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="error: Uncaught (in promise) Error: IO error: Broken pipe (os error 32): Broken pipe (os error 32)
at async deno:ext/websocket/01_websocket.js:507:13"><pre class="notranslate"><code class="notranslate">error: Uncaught (in promise) Error: IO error: Broken pipe (os error 32): Broken pipe (os error 32)
at async deno:ext/websocket/01_websocket.js:507:13
</code></pre></div>
<p dir="auto">I had a look at the source code, and it seems that this set of lines should be included in a try-catch block:</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/denoland/deno/blob/1416713cb3af8a952b1ae9952091706e2540341c/ext/websocket/01_websocket.js#L507">deno/ext/websocket/01_websocket.js</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 507
      in
      <a data-pjax="true" class="commit-tease-sha" href="/denoland/deno/commit/1416713cb3af8a952b1ae9952091706e2540341c">1416713</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L507" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="507"></td>
          <td id="LC507" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">await</span> <span class="pl-s1">core</span><span class="pl-kos">.</span><span class="pl-en">opAsync</span><span class="pl-kos">(</span><span class="pl-s">"op_ws_send"</span><span class="pl-kos">,</span> <span class="pl-smi">this</span><span class="pl-kos">[</span><span class="pl-s1">_rid</span><span class="pl-kos">]</span><span class="pl-kos">,</span> <span class="pl-kos">{</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="await core.opAsync(&quot;op_ws_send&quot;, this[_rid], {
  kind: &quot;ping&quot;,
});"><pre class="notranslate"><code class="notranslate">await core.opAsync("op_ws_send", this[_rid], {
  kind: "ping",
});
</code></pre></div>