mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
refactor: remove unneeded ErrorKinds (#3936)
This commit is contained in:
parent
d9efb8c02a
commit
dd8a109481
66 changed files with 553 additions and 620 deletions
|
@ -1,14 +1,6 @@
|
|||
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
||||
import { join } from "../path/mod.ts";
|
||||
const {
|
||||
readDir,
|
||||
readDirSync,
|
||||
mkdir,
|
||||
mkdirSync,
|
||||
remove,
|
||||
removeSync,
|
||||
ErrorKind
|
||||
} = Deno;
|
||||
const { readDir, readDirSync, mkdir, mkdirSync, remove, removeSync } = Deno;
|
||||
/**
|
||||
* Ensures that a directory is empty.
|
||||
* Deletes directory contents if the directory is not empty.
|
||||
|
@ -28,7 +20,7 @@ export async function emptyDir(dir: string): Promise<void> {
|
|||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if ((err as Deno.DenoError<Deno.ErrorKind>).kind !== ErrorKind.NotFound) {
|
||||
if (!(err instanceof Deno.Err.NotFound)) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
|
@ -57,7 +49,7 @@ export function emptyDirSync(dir: string): void {
|
|||
}
|
||||
}
|
||||
} catch (err) {
|
||||
if ((err as Deno.DenoError<Deno.ErrorKind>).kind !== ErrorKind.NotFound) {
|
||||
if (!(err instanceof Deno.Err.NotFound)) {
|
||||
throw err;
|
||||
}
|
||||
// if not exist. then create it
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue