diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-02-21 10:36:13 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-21 10:36:13 -0500 |
commit | dd8a10948195f231a6a9eb652e3f208813904ad6 (patch) | |
tree | f9a4afeb67bbead882c29c2458a5f1f99e2e42db /std/node | |
parent | d9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff) |
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'std/node')
-rw-r--r-- | std/node/module.ts | 2 | ||||
-rw-r--r-- | std/node/process_test.ts | 4 |
2 files changed, 2 insertions, 4 deletions
diff --git a/std/node/module.ts b/std/node/module.ts index 547c76bab..aecf03ede 100644 --- a/std/node/module.ts +++ b/std/node/module.ts @@ -57,7 +57,7 @@ function stat(filename: string): StatResult { if (statCache !== null) statCache.set(filename, result); return result; } catch (e) { - if (e.kind === Deno.ErrorKind.PermissionDenied) { + if (e instanceof Deno.Err.PermissionDenied) { throw new Error("CJS loader requires --allow-read."); } return -1; diff --git a/std/node/process_test.ts b/std/node/process_test.ts index 51dbcd630..545b6ce23 100644 --- a/std/node/process_test.ts +++ b/std/node/process_test.ts @@ -24,13 +24,11 @@ test({ () => { process.chdir("non-existent-directory-name"); }, - Deno.DenoError, + Deno.Err.NotFound, "file" // On every OS Deno returns: "No such file" except for Windows, where it's: // "The system cannot find the file specified. (os error 2)" so "file" is // the only common string here. - // TODO(rsp): Crazy idea: 404 for things like this? - // It would be nice to have error codes like 404 or 403 in addition to strings. ); } }); |