summaryrefslogtreecommitdiff
path: root/std/fs/exists.ts
diff options
context:
space:
mode:
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;
}