summaryrefslogtreecommitdiff
path: root/std/fs/exists.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-21 10:36:13 -0500
committerGitHub <noreply@github.com>2020-02-21 10:36:13 -0500
commitdd8a10948195f231a6a9eb652e3f208813904ad6 (patch)
treef9a4afeb67bbead882c29c2458a5f1f99e2e42db /std/fs/exists.ts
parentd9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff)
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'std/fs/exists.ts')
-rw-r--r--std/fs/exists.ts14
1 files changed, 5 insertions, 9 deletions
diff --git a/std/fs/exists.ts b/std/fs/exists.ts
index 4584dbff9..2cd415173 100644
--- a/std/fs/exists.ts
+++ b/std/fs/exists.ts
@@ -1,5 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-const { lstat, lstatSync, DenoError, ErrorKind } = Deno;
+const { lstat, lstatSync } = Deno;
/**
* Test whether or not the given path exists by checking with the file system
*/
@@ -7,10 +7,8 @@ export async function exists(filePath: string): Promise<boolean> {
return lstat(filePath)
.then((): boolean => true)
.catch((err: Error): boolean => {
- if (err instanceof DenoError) {
- if (err.kind === ErrorKind.NotFound) {
- return false;
- }
+ if (err instanceof Deno.Err.NotFound) {
+ return false;
}
throw err;
@@ -25,10 +23,8 @@ export function existsSync(filePath: string): boolean {
lstatSync(filePath);
return true;
} catch (err) {
- if (err instanceof DenoError) {
- if (err.kind === ErrorKind.NotFound) {
- return false;
- }
+ if (err instanceof Deno.Err.NotFound) {
+ return false;
}
throw err;
}