mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -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]]
|
[[package]]
|
||||||
name = "deno_config"
|
name = "deno_config"
|
||||||
version = "0.33.1"
|
version = "0.33.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "495df7ebed4feee5c0eb7631b0b86432bb6370638cf81d5eeb5769aab55fb2de"
|
checksum = "84d90b5eacfd6ee4ec978a11739c71eaeb19a575889f8c2b473430df84078fe2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"deno_package_json",
|
"deno_package_json",
|
||||||
|
|
|
@ -65,7 +65,7 @@ winres.workspace = true
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
deno_ast = { workspace = true, features = ["bundler", "cjs", "codegen", "proposal", "react", "sourcemap", "transforms", "typescript", "view", "visit"] }
|
||||||
deno_cache_dir = { workspace = true }
|
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_core = { workspace = true, features = ["include_js_files_for_snapshotting"] }
|
||||||
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
deno_doc = { version = "0.148.0", features = ["html", "syntect"] }
|
||||||
deno_graph = { version = "=0.82.0" }
|
deno_graph = { version = "=0.82.0" }
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
try {
|
try {
|
||||||
Deno.readTextFileSync("a.txt");
|
Deno.readTextFileSync("a.txt");
|
||||||
} catch (err) {
|
} 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
|
// @ts-ignore testing invalid overloads
|
||||||
await Deno.resolveDns("example.com", "SSHFP", nameServer);
|
await Deno.resolveDns("example.com", "SSHFP", nameServer);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.message);
|
console.log((e as Error).message);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -78,7 +78,7 @@ try {
|
||||||
signal: ac.signal,
|
signal: ac.signal,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.name);
|
console.log((e as Error).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -89,5 +89,5 @@ try {
|
||||||
signal: ac.signal,
|
signal: ac.signal,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e.name);
|
console.log((e as Error).name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,6 @@ Deno.test({}, async function queueTestDbClose() {
|
||||||
await db.listenQueue(() => {});
|
await db.listenQueue(() => {});
|
||||||
assertFalse(false);
|
assertFalse(false);
|
||||||
} catch (e) {
|
} 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
|
// 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
|
// different UDP size limits enabled, so we will just ensure if
|
||||||
// an error is thrown it is the one we are expecting.
|
// 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();
|
alice.close();
|
||||||
bob.close();
|
bob.close();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -161,7 +161,7 @@ Deno.test(
|
||||||
try {
|
try {
|
||||||
await Deno.readFile("definitely-not-found.json");
|
await Deno.readFile("definitely-not-found.json");
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEquals(e.code, "ENOENT");
|
assertEquals((e as { code: string }).code, "ENOENT");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -172,7 +172,7 @@ Deno.test(
|
||||||
try {
|
try {
|
||||||
await Deno.readFile("tests/testdata/assets/");
|
await Deno.readFile("tests/testdata/assets/");
|
||||||
} catch (e) {
|
} 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));
|
await core.read(rid, new Uint8Array(1));
|
||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEquals(e.message, `Uh oh (${type})!`);
|
assertEquals((e as Error).message, `Uh oh (${type})!`);
|
||||||
}
|
}
|
||||||
core.close(rid);
|
core.close(rid);
|
||||||
});
|
});
|
||||||
|
@ -429,7 +429,7 @@ function createStreamTest(
|
||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// We expect this to be thrown
|
// We expect this to be thrown
|
||||||
assertEquals(e.message, "Expected error!");
|
assertEquals((e as Error).message, "Expected error!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const buffer = new Uint8Array(1);
|
const buffer = new Uint8Array(1);
|
||||||
|
@ -471,7 +471,7 @@ for (const packetCount of [1, 1024]) {
|
||||||
}
|
}
|
||||||
fail();
|
fail();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
assertEquals(e.message, "operation canceled");
|
assertEquals((e as Error).message, "operation canceled");
|
||||||
}
|
}
|
||||||
assertEquals(await promise, "resource closed");
|
assertEquals(await promise, "resource closed");
|
||||||
});
|
});
|
||||||
|
|
|
@ -588,7 +588,9 @@ async function receiveAlotSendNothing(conn: Deno.Conn) {
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
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 },
|
{ cause: e },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ Deno.test("Built-in Node modules have `node:` prefix", () => {
|
||||||
createRequire();
|
createRequire();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
thrown = true;
|
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 that built-in node modules have `node:<mod_name>` specifiers.
|
||||||
assert(stackLines.some((line: string) => line.includes("(node:module:")));
|
assert(stackLines.some((line: string) => line.includes("(node:module:")));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue