From e1687c0a4616e90d4bbde42b13a0356a7f6a1e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Mon, 24 Feb 2020 15:48:35 -0500 Subject: [PATCH] rename Deno.Err -> Deno.errors (#4093) --- cli/js/chmod_test.ts | 8 +++---- cli/js/chown_test.ts | 10 ++++----- cli/js/copy_file_test.ts | 12 +++++------ cli/js/deno.ts | 2 +- cli/js/dir_test.ts | 4 ++-- cli/js/dispatch_minimal.ts | 4 ++-- cli/js/errors.ts | 4 ++-- cli/js/fetch_test.ts | 4 ++-- cli/js/files_test.ts | 6 +++--- cli/js/fs_events_test.ts | 2 +- cli/js/lib.deno.ns.d.ts | 2 +- cli/js/link_test.ts | 8 +++---- cli/js/make_temp_test.ts | 12 +++++------ cli/js/mkdir_test.ts | 4 ++-- cli/js/net_test.ts | 6 +++--- cli/js/os.ts | 4 ++-- cli/js/os_test.ts | 12 +++++------ cli/js/process_test.ts | 6 +++--- cli/js/read_dir_test.ts | 6 +++--- cli/js/read_file_test.ts | 6 +++--- cli/js/read_link_test.ts | 6 +++--- cli/js/realpath_test.ts | 8 +++---- cli/js/remove_test.ts | 44 +++++++++++++++++++------------------- cli/js/rename_test.ts | 8 +++---- cli/js/stat_test.ts | 16 +++++++------- cli/js/streams/pipe-to.ts | 2 +- cli/js/symlink_test.ts | 2 +- cli/js/tls_test.ts | 10 ++++----- cli/js/truncate_test.ts | 4 ++-- cli/js/utime_test.ts | 8 +++---- cli/js/write_file_test.ts | 12 +++++------ std/fs/copy.ts | 4 ++-- std/fs/empty_dir.ts | 4 ++-- std/fs/ensure_dir.ts | 4 ++-- std/fs/ensure_file.ts | 4 ++-- std/fs/exists.ts | 4 ++-- std/fs/expand_glob.ts | 2 +- std/fs/walk_test.ts | 2 +- std/http/file_server.ts | 2 +- std/node/module.ts | 2 +- std/node/process_test.ts | 2 +- std/testing/runner.ts | 2 +- 42 files changed, 137 insertions(+), 137 deletions(-) diff --git a/cli/js/chmod_test.ts b/cli/js/chmod_test.ts index 24c69db7ab783..d6ff64316ec23 100644 --- a/cli/js/chmod_test.ts +++ b/cli/js/chmod_test.ts @@ -60,7 +60,7 @@ testPerm({ write: true }, function chmodSyncFailure(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: false }, function chmodSyncPerm(): void { @@ -70,7 +70,7 @@ testPerm({ write: false }, function chmodSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -133,7 +133,7 @@ testPerm({ write: true }, async function chmodFailure(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: false }, async function chmodPerm(): Promise { @@ -143,6 +143,6 @@ testPerm({ write: false }, async function chmodPerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/chown_test.ts b/cli/js/chown_test.ts index a1c12860d475b..61c6b87367356 100644 --- a/cli/js/chown_test.ts +++ b/cli/js/chown_test.ts @@ -31,7 +31,7 @@ if (Deno.build.os !== "win") { try { await Deno.chown(filePath, 1000, 1000); } catch (e) { - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } }); @@ -44,7 +44,7 @@ if (Deno.build.os !== "win") { try { Deno.chownSync(filePath, uid, gid); } catch (e) { - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } } ); @@ -58,7 +58,7 @@ if (Deno.build.os !== "win") { try { await Deno.chown(filePath, uid, gid); } catch (e) { - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } } ); @@ -74,7 +74,7 @@ if (Deno.build.os !== "win") { // try changing the file's owner to root Deno.chownSync(filePath, 0, 0); } catch (e) { - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } Deno.removeSync(dirPath, { recursive: true }); }); @@ -92,7 +92,7 @@ if (Deno.build.os !== "win") { // try changing the file's owner to root await Deno.chown(filePath, 0, 0); } catch (e) { - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } await Deno.remove(dirPath, { recursive: true }); }); diff --git a/cli/js/copy_file_test.ts b/cli/js/copy_file_test.ts index 567b246b7babd..aa6daeebfdf4b 100644 --- a/cli/js/copy_file_test.ts +++ b/cli/js/copy_file_test.ts @@ -43,7 +43,7 @@ testPerm({ write: true, read: true }, function copyFileSyncFailure(): void { err = e; } assert(!!err); - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: true, read: false }, function copyFileSyncPerm1(): void { @@ -52,7 +52,7 @@ testPerm({ write: true, read: false }, function copyFileSyncPerm1(): void { Deno.copyFileSync("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -63,7 +63,7 @@ testPerm({ write: false, read: true }, function copyFileSyncPerm2(): void { Deno.copyFileSync("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -110,7 +110,7 @@ testPerm({ read: true, write: true }, async function copyFileFailure(): Promise< err = e; } assert(!!err); - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm( @@ -138,7 +138,7 @@ testPerm({ read: false, write: true }, async function copyFilePerm1(): Promise< await Deno.copyFile("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -151,7 +151,7 @@ testPerm({ read: true, write: false }, async function copyFilePerm2(): Promise< await Deno.copyFile("/from.txt", "/to.txt"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/deno.ts b/cli/js/deno.ts index f5f774179988d..e2052f7293417 100644 --- a/cli/js/deno.ts +++ b/cli/js/deno.ts @@ -22,7 +22,7 @@ export { } from "./diagnostics.ts"; export { chdir, cwd } from "./dir.ts"; export { applySourceMap } from "./error_stack.ts"; -export { Err } from "./errors.ts"; +export { errors } from "./errors.ts"; export { FileInfo } from "./file_info.ts"; export { File, diff --git a/cli/js/dir_test.ts b/cli/js/dir_test.ts index f936986aa271c..6444f35a3bfa8 100644 --- a/cli/js/dir_test.ts +++ b/cli/js/dir_test.ts @@ -29,7 +29,7 @@ testPerm({ write: true }, function dirCwdError(): void { Deno.cwd(); throw Error("current directory removed, should throw error"); } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { console.log(err.name === "NotFound"); } else { throw Error("raised different exception"); @@ -45,7 +45,7 @@ testPerm({ write: true }, function dirChdirError(): void { Deno.chdir(path); throw Error("directory not available, should throw error"); } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { console.log(err.name === "NotFound"); } else { throw Error("raised different exception"); diff --git a/cli/js/dispatch_minimal.ts b/cli/js/dispatch_minimal.ts index 203701085c2b8..988cb8af2f74c 100644 --- a/cli/js/dispatch_minimal.ts +++ b/cli/js/dispatch_minimal.ts @@ -2,7 +2,7 @@ import * as util from "./util.ts"; import { core } from "./core.ts"; import { TextDecoder } from "./text_encoding.ts"; -import { Err, ErrorKind, constructError } from "./errors.ts"; +import { errors, ErrorKind, constructError } from "./errors.ts"; const promiseTableMin = new Map>(); // Note it's important that promiseId starts at 1 instead of 0, because sync @@ -43,7 +43,7 @@ export function recordFromBufMinimal(ui8: Uint8Array): RecordMinimal { const message = decoder.decode(ui8.slice(12)); err = { kind, message }; } else if (ui8.length != 12) { - throw new Err.InvalidData("BadMessage"); + throw new errors.InvalidData("BadMessage"); } return { diff --git a/cli/js/errors.ts b/cli/js/errors.ts index 0844b0a569ca4..0379f3c967e9a 100644 --- a/cli/js/errors.ts +++ b/cli/js/errors.ts @@ -1,6 +1,6 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -// Warning! The values in this enum are duplicated in cli/msg.rs +// Warning! The values in this enum are duplicated in cli/op_error.rs // Update carefully! export enum ErrorKind { NotFound = 1, @@ -179,7 +179,7 @@ class Http extends Error { } } -export const Err = { +export const errors = { NotFound: NotFound, PermissionDenied: PermissionDenied, ConnectionRefused: ConnectionRefused, diff --git a/cli/js/fetch_test.ts b/cli/js/fetch_test.ts index 54bec46bed9d5..a51d1cd4a9d53 100644 --- a/cli/js/fetch_test.ts +++ b/cli/js/fetch_test.ts @@ -27,7 +27,7 @@ testPerm({ net: true }, async function fetchConnectionError(): Promise { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.Http); + assert(err instanceof Deno.errors.Http); assertStrContains(err.message, "error trying to connect"); }); @@ -44,7 +44,7 @@ test(async function fetchPerm(): Promise { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/files_test.ts b/cli/js/files_test.ts index f71bfecc0b341..de0d3019a5037 100644 --- a/cli/js/files_test.ts +++ b/cli/js/files_test.ts @@ -79,7 +79,7 @@ testPerm({ write: false }, async function writePermFailure(): Promise { err = e; } assert(!!err); - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); } }); @@ -136,7 +136,7 @@ testPerm({ read: false }, async function readPermFailure(): Promise { await Deno.open("cli/tests/fixture.json", "r"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -208,7 +208,7 @@ testPerm( err = e; } assert(!!err); - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); } } diff --git a/cli/js/fs_events_test.ts b/cli/js/fs_events_test.ts index 161ee2ebfe0c3..86a5c281357d3 100644 --- a/cli/js/fs_events_test.ts +++ b/cli/js/fs_events_test.ts @@ -8,7 +8,7 @@ testPerm({ read: false }, function fsEventsPermissions() { try { Deno.fsEvents("."); } catch (err) { - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); thrown = true; } assert(thrown); diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 4d7822c907c03..b22d89ebeb4d1 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1217,7 +1217,7 @@ declare namespace Deno { export function applySourceMap(location: Location): Location; /* eslint-disable @typescript-eslint/no-unused-vars */ - namespace Err { + namespace errors { class NotFound extends Error { constructor(msg: string); } diff --git a/cli/js/link_test.ts b/cli/js/link_test.ts index 22920713767c0..b6ba46f2daff0 100644 --- a/cli/js/link_test.ts +++ b/cli/js/link_test.ts @@ -43,7 +43,7 @@ testPerm({ read: true, write: true }, function linkSyncExists(): void { err = e; } assert(!!err); - assert(err instanceof Deno.Err.AlreadyExists); + assert(err instanceof Deno.errors.AlreadyExists); }); testPerm({ read: true, write: true }, function linkSyncNotFound(): void { @@ -58,7 +58,7 @@ testPerm({ read: true, write: true }, function linkSyncNotFound(): void { err = e; } assert(!!err); - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ read: false, write: true }, function linkSyncReadPerm(): void { @@ -68,7 +68,7 @@ testPerm({ read: false, write: true }, function linkSyncReadPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -79,7 +79,7 @@ testPerm({ read: true, write: false }, function linkSyncWritePerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/make_temp_test.ts b/cli/js/make_temp_test.ts index 06bfe0373895a..83a174e831b57 100644 --- a/cli/js/make_temp_test.ts +++ b/cli/js/make_temp_test.ts @@ -23,7 +23,7 @@ testPerm({ write: true }, function makeTempDirSyncSuccess(): void { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); test(function makeTempDirSyncPerm(): void { @@ -34,7 +34,7 @@ test(function makeTempDirSyncPerm(): void { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -60,7 +60,7 @@ testPerm({ write: true }, async function makeTempDirSuccess(): Promise { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: true }, function makeTempFileSyncSuccess(): void { @@ -86,7 +86,7 @@ testPerm({ write: true }, function makeTempFileSyncSuccess(): void { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); test(function makeTempFileSyncPerm(): void { @@ -97,7 +97,7 @@ test(function makeTempFileSyncPerm(): void { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -124,5 +124,5 @@ testPerm({ write: true }, async function makeTempFileSuccess(): Promise { } catch (err_) { err = err_; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); diff --git a/cli/js/mkdir_test.ts b/cli/js/mkdir_test.ts index 856cbdeb5b1f0..655a23dc337fc 100644 --- a/cli/js/mkdir_test.ts +++ b/cli/js/mkdir_test.ts @@ -25,7 +25,7 @@ testPerm({ write: false }, function mkdirSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -45,7 +45,7 @@ testPerm({ write: true }, function mkdirErrIfExists(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.AlreadyExists); + assert(err instanceof Deno.errors.AlreadyExists); }); testPerm({ read: true, write: true }, function mkdirSyncRecursive(): void { diff --git a/cli/js/net_test.ts b/cli/js/net_test.ts index 75bce2e52c8ea..94e7c976e97ab 100644 --- a/cli/js/net_test.ts +++ b/cli/js/net_test.ts @@ -223,7 +223,7 @@ testPerm({ net: true }, async function netDoubleCloseRead() { err = e; } assert(!!err); - assert(err instanceof Deno.Err.NotConnected); + assert(err instanceof Deno.errors.NotConnected); closeDeferred.resolve(); listener.close(); conn.close(); @@ -257,7 +257,7 @@ testPerm({ net: true }, async function netCloseWriteSuccess() { err = e; } assert(!!err); - assert(err instanceof Deno.Err.BrokenPipe); + assert(err instanceof Deno.errors.BrokenPipe); closeDeferred.resolve(); listener.close(); conn.close(); @@ -283,7 +283,7 @@ testPerm({ net: true }, async function netDoubleCloseWrite() { err = e; } assert(!!err); - assert(err instanceof Deno.Err.NotConnected); + assert(err instanceof Deno.errors.NotConnected); closeDeferred.resolve(); listener.close(); conn.close(); diff --git a/cli/js/os.ts b/cli/js/os.ts index 7953c2cef7fa1..7458ee469c9cb 100644 --- a/cli/js/os.ts +++ b/cli/js/os.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import * as dispatch from "./dispatch.ts"; import { sendSync } from "./dispatch_json.ts"; -import { Err } from "./errors.ts"; +import { errors } from "./errors.ts"; import * as util from "./util.ts"; /** Check if running in terminal. @@ -210,7 +210,7 @@ export function dir(kind: DirKind): string | null { try { return sendSync(dispatch.OP_GET_DIR, { kind }); } catch (error) { - if (error instanceof Err.PermissionDenied) { + if (error instanceof errors.PermissionDenied) { throw error; } return null; diff --git a/cli/js/os_test.ts b/cli/js/os_test.ts index 905a4efaf5185..11d2db8fe02e4 100644 --- a/cli/js/os_test.ts +++ b/cli/js/os_test.ts @@ -31,7 +31,7 @@ test(function envPermissionDenied1(): void { err = e; } assertNotEquals(err, undefined); - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -43,7 +43,7 @@ test(function envPermissionDenied2(): void { err = e; } assertNotEquals(err, undefined); - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -262,7 +262,7 @@ testPerm({ env: true }, function getDir(): void { testPerm({}, function getDirWithoutPermission(): void { assertThrows( () => Deno.dir("home"), - Deno.Err.PermissionDenied, + Deno.errors.PermissionDenied, `run again with the --allow-env flag` ); }); @@ -277,7 +277,7 @@ testPerm({ env: false }, function execPathPerm(): void { Deno.execPath(); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); } assert(caughtError); @@ -294,7 +294,7 @@ testPerm({ env: false }, function loadavgPerm(): void { Deno.loadavg(); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); } assert(caughtError); @@ -310,7 +310,7 @@ testPerm({ env: false }, function hostnamePerm(): void { Deno.hostname(); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); } assert(caughtError); diff --git a/cli/js/process_test.ts b/cli/js/process_test.ts index 51ba8bfb3a6d2..fc9d15140199d 100644 --- a/cli/js/process_test.ts +++ b/cli/js/process_test.ts @@ -14,7 +14,7 @@ test(function runPermissions(): void { Deno.run({ args: ["python", "-c", "print('hello world')"] }); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -68,7 +68,7 @@ testPerm({ run: true }, function runNotFound(): void { error = e; } assert(error !== undefined); - assert(error instanceof Deno.Err.NotFound); + assert(error instanceof Deno.errors.NotFound); }); testPerm( @@ -321,7 +321,7 @@ if (Deno.build.os !== "win") { Deno.kill(Deno.pid, Deno.Signal.SIGCONT); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/read_dir_test.ts b/cli/js/read_dir_test.ts index 4496d74475690..97a2e871a3a92 100644 --- a/cli/js/read_dir_test.ts +++ b/cli/js/read_dir_test.ts @@ -32,7 +32,7 @@ testPerm({ read: false }, function readDirSyncPerm(): void { Deno.readDirSync("tests/"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -59,7 +59,7 @@ testPerm({ read: true }, function readDirSyncNotFound(): void { src = Deno.readDirSync("bad_dir_name"); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } assert(caughtError); assertEquals(src, undefined); @@ -76,7 +76,7 @@ testPerm({ read: false }, async function readDirPerm(): Promise { await Deno.readDir("tests/"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/read_file_test.ts b/cli/js/read_file_test.ts index 726f0841392eb..256568587e4de 100644 --- a/cli/js/read_file_test.ts +++ b/cli/js/read_file_test.ts @@ -16,7 +16,7 @@ testPerm({ read: false }, function readFileSyncPerm(): void { Deno.readFileSync("cli/tests/fixture.json"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -28,7 +28,7 @@ testPerm({ read: true }, function readFileSyncNotFound(): void { data = Deno.readFileSync("bad_filename"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); assert(data === undefined); @@ -49,7 +49,7 @@ testPerm({ read: false }, async function readFilePerm(): Promise { await Deno.readFile("cli/tests/fixture.json"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/read_link_test.ts b/cli/js/read_link_test.ts index 6f028c08d5025..498b65c0a89cd 100644 --- a/cli/js/read_link_test.ts +++ b/cli/js/read_link_test.ts @@ -21,7 +21,7 @@ testPerm({ read: false }, async function readlinkSyncPerm(): Promise { Deno.readlinkSync("/symlink"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -33,7 +33,7 @@ testPerm({ read: true }, function readlinkSyncNotFound(): void { data = Deno.readlinkSync("bad_filename"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); assertEquals(data, undefined); @@ -61,7 +61,7 @@ testPerm({ read: false }, async function readlinkPerm(): Promise { await Deno.readlink("/symlink"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/realpath_test.ts b/cli/js/realpath_test.ts index 6dfec45fc810d..8242c325eb130 100644 --- a/cli/js/realpath_test.ts +++ b/cli/js/realpath_test.ts @@ -31,7 +31,7 @@ testPerm({ read: false }, function realpathSyncPerm(): void { Deno.realpathSync("some_file"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -42,7 +42,7 @@ testPerm({ read: true }, function realpathSyncNotFound(): void { Deno.realpathSync("bad_filename"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); }); @@ -80,7 +80,7 @@ testPerm({ read: false }, async function realpathPerm(): Promise { await Deno.realpath("some_file"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -91,7 +91,7 @@ testPerm({ read: true }, async function realpathNotFound(): Promise { await Deno.realpath("bad_filename"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); }); diff --git a/cli/js/remove_test.ts b/cli/js/remove_test.ts index cb89ea1a96028..e7d07ebcc6fcf 100644 --- a/cli/js/remove_test.ts +++ b/cli/js/remove_test.ts @@ -18,7 +18,7 @@ testPerm({ write: true, read: true }, function removeSyncDirSuccess(): void { err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: true, read: true }, function removeSyncFileSuccess(): void { @@ -38,7 +38,7 @@ testPerm({ write: true, read: true }, function removeSyncFileSuccess(): void { err = e; } // File is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: true, read: true }, function removeSyncFail(): void { @@ -67,7 +67,7 @@ testPerm({ write: true, read: true }, function removeSyncFail(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm( @@ -93,7 +93,7 @@ testPerm( } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } } ); @@ -127,7 +127,7 @@ testPerm( err = e; } Deno.removeSync(filePath); - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } } ); @@ -139,7 +139,7 @@ testPerm({ write: false }, function removeSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -158,7 +158,7 @@ testPerm({ write: true, read: true }, function removeAllSyncDirSuccess(): void { err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); // REMOVE NON-EMPTY DIRECTORY path = Deno.makeTempDirSync() + "/dir/subdir"; @@ -177,7 +177,7 @@ testPerm({ write: true, read: true }, function removeAllSyncDirSuccess(): void { err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm( @@ -199,7 +199,7 @@ testPerm( err = e; } // File is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -212,7 +212,7 @@ testPerm({ write: true }, function removeAllSyncFail(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: false }, function removeAllSyncPerm(): void { @@ -222,7 +222,7 @@ testPerm({ write: false }, function removeAllSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -245,7 +245,7 @@ testPerm( err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -268,7 +268,7 @@ testPerm( err = e; } // File is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -299,7 +299,7 @@ testPerm({ write: true, read: true }, async function removeFail(): Promise< } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm( @@ -325,7 +325,7 @@ testPerm( } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } } ); @@ -359,7 +359,7 @@ testPerm( err = e; } Deno.removeSync(filePath); - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } } ); @@ -371,7 +371,7 @@ testPerm({ write: false }, async function removePerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -392,7 +392,7 @@ testPerm( err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); // REMOVE NON-EMPTY DIRECTORY path = Deno.makeTempDirSync() + "/dir/subdir"; @@ -411,7 +411,7 @@ testPerm( err = e; } // Directory is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -434,7 +434,7 @@ testPerm( err = e; } // File is gone - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -447,7 +447,7 @@ testPerm({ write: true }, async function removeAllFail(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); }); testPerm({ write: false }, async function removeAllPerm(): Promise { @@ -457,6 +457,6 @@ testPerm({ write: false }, async function removeAllPerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/rename_test.ts b/cli/js/rename_test.ts index 3673d84894464..504a351eea20c 100644 --- a/cli/js/rename_test.ts +++ b/cli/js/rename_test.ts @@ -17,7 +17,7 @@ testPerm({ read: true, write: true }, function renameSyncSuccess(): void { oldPathInfo = Deno.statSync(oldpath); } catch (e) { caughtErr = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtErr); assertEquals(oldPathInfo, undefined); @@ -32,7 +32,7 @@ testPerm({ read: false, write: true }, function renameSyncReadPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -45,7 +45,7 @@ testPerm({ read: true, write: false }, function renameSyncWritePerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -67,7 +67,7 @@ testPerm({ read: true, write: true }, async function renameSuccess(): Promise< oldPathInfo = Deno.statSync(oldpath); } catch (e) { caughtErr = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtErr); assertEquals(oldPathInfo, undefined); diff --git a/cli/js/stat_test.ts b/cli/js/stat_test.ts index 3914f877ca9ec..98ef091ab256a 100644 --- a/cli/js/stat_test.ts +++ b/cli/js/stat_test.ts @@ -23,7 +23,7 @@ testPerm({ read: false }, async function statSyncPerm(): Promise { Deno.statSync("README.md"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -36,7 +36,7 @@ testPerm({ read: true }, async function statSyncNotFound(): Promise { badInfo = Deno.statSync("bad_file_name"); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } assert(caughtError); @@ -63,7 +63,7 @@ testPerm({ read: false }, async function lstatSyncPerm(): Promise { Deno.lstatSync("README.md"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -76,7 +76,7 @@ testPerm({ read: true }, async function lstatSyncNotFound(): Promise { badInfo = Deno.lstatSync("bad_file_name"); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } assert(caughtError); @@ -103,7 +103,7 @@ testPerm({ read: false }, async function statPerm(): Promise { await Deno.stat("README.md"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -116,7 +116,7 @@ testPerm({ read: true }, async function statNotFound(): Promise { badInfo = await Deno.stat("bad_file_name"); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } assert(caughtError); @@ -143,7 +143,7 @@ testPerm({ read: false }, async function lstatPerm(): Promise { await Deno.lstat("README.md"); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -156,7 +156,7 @@ testPerm({ read: true }, async function lstatNotFound(): Promise { badInfo = await Deno.lstat("bad_file_name"); } catch (err) { caughtError = true; - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } assert(caughtError); diff --git a/cli/js/streams/pipe-to.ts b/cli/js/streams/pipe-to.ts index 01608b955f920..1d55792174901 100644 --- a/cli/js/streams/pipe-to.ts +++ b/cli/js/streams/pipe-to.ts @@ -50,7 +50,7 @@ // abortAlgorithm = (): void => { // // TODO this should be a DOMException, // // https://github.com/stardazed/sd-streams/blob/master/packages/streams/src/pipe-to.ts#L38 -// const error = new Err.Aborted("Aborted"); +// const error = new errors.Aborted("Aborted"); // const actions: Array<() => Promise> = []; // if (preventAbort === false) { // actions.push(() => { diff --git a/cli/js/symlink_test.ts b/cli/js/symlink_test.ts index b89b718b369fe..fbb2ec867c93e 100644 --- a/cli/js/symlink_test.ts +++ b/cli/js/symlink_test.ts @@ -31,7 +31,7 @@ test(function symlinkSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/tls_test.ts b/cli/js/tls_test.ts index dabbb2c899d30..69832127495cf 100644 --- a/cli/js/tls_test.ts +++ b/cli/js/tls_test.ts @@ -13,7 +13,7 @@ test(async function connectTLSNoPerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -28,7 +28,7 @@ test(async function connectTLSCertFileNoReadPerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -51,7 +51,7 @@ testPerm( } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); try { Deno.listenTLS({ @@ -61,7 +61,7 @@ testPerm( } catch (e) { err = e; } - assert(err instanceof Deno.Err.NotFound); + assert(err instanceof Deno.errors.NotFound); } ); @@ -77,7 +77,7 @@ testPerm({ net: true }, async function listenTLSNoReadPerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/truncate_test.ts b/cli/js/truncate_test.ts index 42583354c2e82..bec51b04d8cd5 100644 --- a/cli/js/truncate_test.ts +++ b/cli/js/truncate_test.ts @@ -58,7 +58,7 @@ testPerm({ write: false }, function truncateSyncPerm(): void { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); @@ -69,6 +69,6 @@ testPerm({ write: false }, async function truncatePerm(): Promise { } catch (e) { err = e; } - assert(err instanceof Deno.Err.PermissionDenied); + assert(err instanceof Deno.errors.PermissionDenied); assertEquals(err.name, "PermissionDenied"); }); diff --git a/cli/js/utime_test.ts b/cli/js/utime_test.ts index c7e4293bf696a..7d6a72f474a80 100644 --- a/cli/js/utime_test.ts +++ b/cli/js/utime_test.ts @@ -78,7 +78,7 @@ testPerm({ read: true, write: true }, function utimeSyncNotFound(): void { Deno.utimeSync("/baddir", atime, mtime); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); }); @@ -92,7 +92,7 @@ testPerm({ read: true, write: false }, function utimeSyncPerm(): void { Deno.utimeSync("/some_dir", atime, mtime); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -157,7 +157,7 @@ testPerm({ read: true, write: true }, async function utimeNotFound(): Promise< await Deno.utime("/baddir", atime, mtime); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); }); @@ -173,7 +173,7 @@ testPerm({ read: true, write: false }, async function utimeSyncPerm(): Promise< await Deno.utime("/some_dir", atime, mtime); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); diff --git a/cli/js/write_file_test.ts b/cli/js/write_file_test.ts index 9f58f44602a9e..d788748f88bc8 100644 --- a/cli/js/write_file_test.ts +++ b/cli/js/write_file_test.ts @@ -22,7 +22,7 @@ testPerm({ write: true }, function writeFileSyncFail(): void { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); }); @@ -37,7 +37,7 @@ testPerm({ write: false }, function writeFileSyncPerm(): void { Deno.writeFileSync(filename, data); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -64,7 +64,7 @@ testPerm({ read: true, write: true }, function writeFileSyncCreate(): void { Deno.writeFileSync(filename, data, { create: false }); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); @@ -125,7 +125,7 @@ testPerm( await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); } @@ -143,7 +143,7 @@ testPerm({ read: true, write: false }, async function writeFilePerm(): Promise< await Deno.writeFile(filename, data); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.PermissionDenied); + assert(e instanceof Deno.errors.PermissionDenied); } assert(caughtError); }); @@ -175,7 +175,7 @@ testPerm({ read: true, write: true }, async function writeFileCreate(): Promise< await Deno.writeFile(filename, data, { create: false }); } catch (e) { caughtError = true; - assert(e instanceof Deno.Err.NotFound); + assert(e instanceof Deno.errors.NotFound); } assert(caughtError); diff --git a/std/fs/copy.ts b/std/fs/copy.ts index ec51784c66463..d19c120f7f612 100644 --- a/std/fs/copy.ts +++ b/std/fs/copy.ts @@ -29,7 +29,7 @@ async function ensureValidCopy( try { destStat = await Deno.lstat(dest); } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { return; } throw err; @@ -57,7 +57,7 @@ function ensureValidCopySync( try { destStat = Deno.lstatSync(dest); } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { return; } throw err; diff --git a/std/fs/empty_dir.ts b/std/fs/empty_dir.ts index 0ac5e6420cfd5..a848e90a16bce 100644 --- a/std/fs/empty_dir.ts +++ b/std/fs/empty_dir.ts @@ -20,7 +20,7 @@ export async function emptyDir(dir: string): Promise { } } } catch (err) { - if (!(err instanceof Deno.Err.NotFound)) { + if (!(err instanceof Deno.errors.NotFound)) { throw err; } @@ -49,7 +49,7 @@ export function emptyDirSync(dir: string): void { } } } catch (err) { - if (!(err instanceof Deno.Err.NotFound)) { + if (!(err instanceof Deno.errors.NotFound)) { throw err; } // if not exist. then create it diff --git a/std/fs/ensure_dir.ts b/std/fs/ensure_dir.ts index b6cc3150a3566..a74261c610e00 100644 --- a/std/fs/ensure_dir.ts +++ b/std/fs/ensure_dir.ts @@ -16,7 +16,7 @@ export async function ensureDir(dir: string): Promise { ); } } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { // if dir not exists. then create it. await mkdir(dir, { recursive: true }); return; @@ -39,7 +39,7 @@ export function ensureDirSync(dir: string): void { ); } } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { // if dir not exists. then create it. mkdirSync(dir, { recursive: true }); return; diff --git a/std/fs/ensure_file.ts b/std/fs/ensure_file.ts index be824b7bac127..77732164a358a 100644 --- a/std/fs/ensure_file.ts +++ b/std/fs/ensure_file.ts @@ -23,7 +23,7 @@ export async function ensureFile(filePath: string): Promise { } } catch (err) { // if file not exists - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.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.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { // ensure dir exists ensureDirSync(path.dirname(filePath)); // create file diff --git a/std/fs/exists.ts b/std/fs/exists.ts index 2cd4151739d5b..ae64cb1f3f826 100644 --- a/std/fs/exists.ts +++ b/std/fs/exists.ts @@ -7,7 +7,7 @@ export async function exists(filePath: string): Promise { return lstat(filePath) .then((): boolean => true) .catch((err: Error): boolean => { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { return false; } @@ -23,7 +23,7 @@ export function existsSync(filePath: string): boolean { lstatSync(filePath); return true; } catch (err) { - if (err instanceof Deno.Err.NotFound) { + if (err instanceof Deno.errors.NotFound) { return false; } throw err; diff --git a/std/fs/expand_glob.ts b/std/fs/expand_glob.ts index 61fca96028c9a..c6653eda12358 100644 --- a/std/fs/expand_glob.ts +++ b/std/fs/expand_glob.ts @@ -43,7 +43,7 @@ function split(path: string): SplitPath { } function throwUnlessNotFound(error: Error): void { - if (!(error instanceof Deno.Err.NotFound)) { + if (!(error instanceof Deno.errors.NotFound)) { throw error; } } diff --git a/std/fs/walk_test.ts b/std/fs/walk_test.ts index f99f82eb51626..caf806262c980 100644 --- a/std/fs/walk_test.ts +++ b/std/fs/walk_test.ts @@ -235,7 +235,7 @@ testWalk( async function nonexistentRoot(): Promise { await assertThrowsAsync(async () => { await walkArray("nonexistent"); - }, Deno.Err.NotFound); + }, Deno.errors.NotFound); } ); diff --git a/std/http/file_server.ts b/std/http/file_server.ts index acc3a20cd20a3..da2b0b5a2b7f4 100755 --- a/std/http/file_server.ts +++ b/std/http/file_server.ts @@ -163,7 +163,7 @@ async function serveDir( } async function serveFallback(req: ServerRequest, e: Error): Promise { - if (e instanceof Deno.Err.NotFound) { + if (e instanceof Deno.errors.NotFound) { return { status: 404, body: encoder.encode("Not found") diff --git a/std/node/module.ts b/std/node/module.ts index aecf03ede6f4e..3520d804b99f8 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 instanceof Deno.Err.PermissionDenied) { + if (e instanceof Deno.errors.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 545b6ce23f750..f44143acbc3f3 100644 --- a/std/node/process_test.ts +++ b/std/node/process_test.ts @@ -24,7 +24,7 @@ test({ () => { process.chdir("non-existent-directory-name"); }, - Deno.Err.NotFound, + Deno.errors.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 diff --git a/std/testing/runner.ts b/std/testing/runner.ts index 772e027241cf7..65b7be66d7144 100755 --- a/std/testing/runner.ts +++ b/std/testing/runner.ts @@ -182,7 +182,7 @@ export async function runTestModules({ if (moduleCount == 0) { const noneFoundMessage = "No matching test modules found."; if (!allowNone) { - throw new Deno.Err.NotFound(noneFoundMessage); + throw new Deno.errors.NotFound(noneFoundMessage); } else if (!disableLog) { console.log(noneFoundMessage); }