<p dir="auto">Currently, we're not consistent with errors thrown in <code class="notranslate">std/node</code> and we should implement Node.js errors instead of throwing Deno errors.</p>
<p dir="auto">For example a common check for Node.js <code class="notranslate">fs</code> is:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="e.code === 'ENOENT'"><pre class="notranslate"><code class="notranslate">e.code === 'ENOENT'
</code></pre></div>
<p dir="auto">The above is not currently supported.</p>
<p dir="auto"><em>if we want to be compatible with node's API, we must be kind to its errors too.</em></p>
<p dir="auto">we should support node's API errors listed <a href="https://nodejs.org/dist/latest-v14.x/docs/api/errors.html" rel="nofollow">here</a> to be more consistent about errors.</p>
<p dir="auto">todo list :</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> create error module in std/node</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> support node error codes ( like <a href="https://nodejs.org/dist/latest-v12.x/docs/api/errors.html#errors_err_invalid_callback" rel="nofollow">ERR_INVALID_CALLBACK</a> )</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> replace handwritten errors with error codes ( like <a href="https://github.com/denoland/deno/blob/49c70774012e929b3c77b808edc5a7908bcb6fa2/std/node/_fs/_fs_appendFile.ts#L27">HERE</a> )</li>
</ul>