denoland / denoland/node_shims

Provide Node.js error constructors for Deno namespace errors

Open
#87 3 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
160
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Currently [Node.js `SystemError`](https://nodejs.org/api/errors.html#class-systemerror) doesn't work well with `Deno.errors`, for example, when a file is not found, Node.js produces a `SystemError` with a code of `ENOENT` which equates to a `Deno.errors.NotFound`, but `err instanceof Deno.errors.NotFound` works under Deno, but fails under Node.js.

We should consider providing a `[Symbol.hasInstance]` implementation for a special class of `Deno.errors` in the shim that would do further analysis on the Node.js error instances and see if it maps back to a Deno error, so `instanceof` operator can work.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.