summaryrefslogtreecommitdiff
path: root/cli/js/40_bench.js
diff options
context:
space:
mode:
authorIan Bull <irbull@gmail.com>2024-09-04 00:19:55 -0700
committerGitHub <noreply@github.com>2024-09-04 09:19:55 +0200
commit939c23f9fe332797f4b2c8a80359fd36a3e7c105 (patch)
treec20c31bf6b95290e1b4bcaa83d087bd13a0eb902 /cli/js/40_bench.js
parent072bf5d379b691c4decd3c167a51801bad8ca2f6 (diff)
refactor(cli/js): align error messages (#25406)
Aligns the error messages in the cli/js folder to be in-line with the Deno style guide.
Diffstat (limited to 'cli/js/40_bench.js')
-rw-r--r--cli/js/40_bench.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/cli/js/40_bench.js b/cli/js/40_bench.js
index a94c782fc..b07df3993 100644
--- a/cli/js/40_bench.js
+++ b/cli/js/40_bench.js
@@ -104,12 +104,12 @@ function bench(
}
if (optionsOrFn.fn != undefined) {
throw new TypeError(
- "Unexpected 'fn' field in options, bench function is already provided as the third argument.",
+ "Unexpected 'fn' field in options, bench function is already provided as the third argument",
);
}
if (optionsOrFn.name != undefined) {
throw new TypeError(
- "Unexpected 'name' field in options, bench name is already provided as the first argument.",
+ "Unexpected 'name' field in options, bench name is already provided as the first argument",
);
}
benchDesc = {
@@ -141,7 +141,7 @@ function bench(
fn = optionsOrFn;
if (nameOrFnOrOptions.fn != undefined) {
throw new TypeError(
- "Unexpected 'fn' field in options, bench function is already provided as the second argument.",
+ "Unexpected 'fn' field in options, bench function is already provided as the second argument",
);
}
name = nameOrFnOrOptions.name ?? fn.name;
@@ -150,7 +150,7 @@ function bench(
!nameOrFnOrOptions.fn || typeof nameOrFnOrOptions.fn !== "function"
) {
throw new TypeError(
- "Expected 'fn' field in the first argument to be a bench function.",
+ "Expected 'fn' field in the first argument to be a bench function",
);
}
fn = nameOrFnOrOptions.fn;
@@ -385,12 +385,12 @@ function createBenchContext(desc) {
start() {
if (currentBenchId !== desc.id) {
throw new TypeError(
- "The benchmark which this context belongs to is not being executed.",
+ "The benchmark which this context belongs to is not being executed",
);
}
if (currentBenchUserExplicitStart != null) {
throw new TypeError(
- "BenchContext::start() has already been invoked.",
+ "BenchContext::start() has already been invoked",
);
}
currentBenchUserExplicitStart = benchNow();
@@ -399,11 +399,11 @@ function createBenchContext(desc) {
const end = benchNow();
if (currentBenchId !== desc.id) {
throw new TypeError(
- "The benchmark which this context belongs to is not being executed.",
+ "The benchmark which this context belongs to is not being executed",
);
}
if (currentBenchUserExplicitEnd != null) {
- throw new TypeError("BenchContext::end() has already been invoked.");
+ throw new TypeError("BenchContext::end() has already been invoked");
}
currentBenchUserExplicitEnd = end;
},