mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
feat(check): turn on useUnknownInCatchVariables (#25465)
Part of #25162 Closes #11826
This commit is contained in:
parent
b54347c448
commit
15fce5b290
10 changed files with 18 additions and 16 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -1374,9 +1374,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "deno_config"
|
||||
version = "0.33.1"
|
||||
version = "0.33.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "495df7ebed4feee5c0eb7631b0b86432bb6370638cf81d5eeb5769aab55fb2de"
|
||||
checksum = "84d90b5eacfd6ee4ec978a11739c71eaeb19a575889f8c2b473430df84078fe2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"deno_package_json",
|
||||
|
|
|
@ -65,7 +65,7 @@ winres.workspace = true
|
|||
[dependencies]
|
||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||
deno_cache_dir = { workspace = true }
|
||||
deno_config = { version = "=0.33.1", features = ["workspace", "sync"] }
|
||||
deno_config = { version = "=0.33.2", features = ["workspace", "sync"] }
|
||||
deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
||||
deno_graph = { version = "=0.82.0" }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
try {
|
||||
Deno.readTextFileSync("a.txt");
|
||||
} catch (err) {
|
||||
console.log(err.message);
|
||||
console.log((err as Error).message);
|
||||
}
|
||||
|
|
6
tests/testdata/run/resolve_dns.ts
vendored
6
tests/testdata/run/resolve_dns.ts
vendored
|
@ -67,7 +67,7 @@ try {
|
|||
// @ts-ignore testing invalid overloads
|
||||
await Deno.resolveDns("example.com", "SSHFP", nameServer);
|
||||
} catch (e) {
|
||||
console.log(e.message);
|
||||
console.log((e as Error).message);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -78,7 +78,7 @@ try {
|
|||
signal: ac.signal,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.name);
|
||||
console.log((e as Error).name);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -89,5 +89,5 @@ try {
|
|||
signal: ac.signal,
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e.name);
|
||||
console.log((e as Error).name);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,6 @@ Deno.test({}, async function queueTestDbClose() {
|
|||
await db.listenQueue(() => {});
|
||||
assertFalse(false);
|
||||
} catch (e) {
|
||||
assertEquals(e.message, "already closed");
|
||||
assertEquals((e as Error).message, "already closed");
|
||||
}
|
||||
});
|
||||
|
|
|
@ -443,7 +443,7 @@ Deno.test(
|
|||
// Note: we have to do the test this way as different OS's have
|
||||
// different UDP size limits enabled, so we will just ensure if
|
||||
// an error is thrown it is the one we are expecting.
|
||||
assert(err.message.match(rx));
|
||||
assert((err as Error).message.match(rx));
|
||||
alice.close();
|
||||
bob.close();
|
||||
return;
|
||||
|
|
|
@ -161,7 +161,7 @@ Deno.test(
|
|||
try {
|
||||
await Deno.readFile("definitely-not-found.json");
|
||||
} catch (e) {
|
||||
assertEquals(e.code, "ENOENT");
|
||||
assertEquals((e as { code: string }).code, "ENOENT");
|
||||
}
|
||||
},
|
||||
);
|
||||
|
@ -172,7 +172,7 @@ Deno.test(
|
|||
try {
|
||||
await Deno.readFile("tests/testdata/assets/");
|
||||
} catch (e) {
|
||||
assertEquals(e.code, "EISDIR");
|
||||
assertEquals((e as { code: string }).code, "EISDIR");
|
||||
}
|
||||
},
|
||||
);
|
||||
|
|
|
@ -298,7 +298,7 @@ for (
|
|||
await core.read(rid, new Uint8Array(1));
|
||||
fail();
|
||||
} catch (e) {
|
||||
assertEquals(e.message, `Uh oh (${type})!`);
|
||||
assertEquals((e as Error).message, `Uh oh (${type})!`);
|
||||
}
|
||||
core.close(rid);
|
||||
});
|
||||
|
@ -429,7 +429,7 @@ function createStreamTest(
|
|||
fail();
|
||||
} catch (e) {
|
||||
// We expect this to be thrown
|
||||
assertEquals(e.message, "Expected error!");
|
||||
assertEquals((e as Error).message, "Expected error!");
|
||||
}
|
||||
} else {
|
||||
const buffer = new Uint8Array(1);
|
||||
|
@ -471,7 +471,7 @@ for (const packetCount of [1, 1024]) {
|
|||
}
|
||||
fail();
|
||||
} catch (e) {
|
||||
assertEquals(e.message, "operation canceled");
|
||||
assertEquals((e as Error).message, "operation canceled");
|
||||
}
|
||||
assertEquals(await promise, "resource closed");
|
||||
});
|
||||
|
|
|
@ -588,7 +588,9 @@ async function receiveAlotSendNothing(conn: Deno.Conn) {
|
|||
}
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Got an error (${e.message}) after reading ${nread}/${largeAmount} bytes`,
|
||||
`Got an error (${
|
||||
(e as Error).message
|
||||
}) after reading ${nread}/${largeAmount} bytes`,
|
||||
{ cause: e },
|
||||
);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ Deno.test("Built-in Node modules have `node:` prefix", () => {
|
|||
createRequire();
|
||||
} catch (e) {
|
||||
thrown = true;
|
||||
const stackLines = e.stack.split("\n");
|
||||
const stackLines = (e as Error).stack!.split("\n");
|
||||
// Assert that built-in node modules have `node:<mod_name>` specifiers.
|
||||
assert(stackLines.some((line: string) => line.includes("(node:module:")));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue