summaryrefslogtreecommitdiff
path: root/std/fs/ensure_file.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/ensure_file.ts
parentd9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff)
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'std/fs/ensure_file.ts')
-rw-r--r--std/fs/ensure_file.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/std/fs/ensure_file.ts b/std/fs/ensure_file.ts
index 06c65b5f7..be824b7ba 100644
--- a/std/fs/ensure_file.ts
+++ b/std/fs/ensure_file.ts
@@ -2,7 +2,7 @@
import * as path from "../path/mod.ts";
import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
import { getFileInfoType } from "./utils.ts";
-const { lstat, lstatSync, writeFile, writeFileSync, ErrorKind } = Deno;
+const { lstat, lstatSync, writeFile, writeFileSync } = Deno;
/**
* Ensures that the file exists.
@@ -23,7 +23,7 @@ export async function ensureFile(filePath: string): Promise<void> {
}
} catch (err) {
// if file not exists
- if (err instanceof Deno.DenoError && err.kind === ErrorKind.NotFound) {
+ if (err instanceof Deno.Err.NotFound) {
// ensure dir exists
await ensureDir(path.dirname(filePath));
// create file
@@ -54,7 +54,7 @@ export function ensureFileSync(filePath: string): void {
}
} catch (err) {
// if file not exists
- if (err instanceof Deno.DenoError && err.kind === ErrorKind.NotFound) {
+ if (err instanceof Deno.Err.NotFound) {
// ensure dir exists
ensureDirSync(path.dirname(filePath));
// create file