From 7083aab02ffa40fd74dcbb76b2fc35dd6c35323e Mon Sep 17 00:00:00 2001 From: Ian Bull Date: Fri, 13 Sep 2024 18:44:51 -0700 Subject: [PATCH] refactor(ext/webidl): align error messages Aligns the error messages in the ext/webidl folder to be in-line with the Deno style guide. https://github.com/denoland/deno/issues/25269 --- ext/webidl/00_webidl.js | 10 +++++----- tests/testdata/run/error_009_extensions_error.js.out | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/webidl/00_webidl.js b/ext/webidl/00_webidl.js index f23c9b7dd0b3ac..1d05aae5fa96ba 100644 --- a/ext/webidl/00_webidl.js +++ b/ext/webidl/00_webidl.js @@ -712,7 +712,7 @@ function requiredArguments(length, required, prefix) { if (length < required) { const errMsg = `${prefix ? prefix + ": " : ""}${required} argument${ required === 1 ? "" : "s" - } required, but only ${length} present.`; + } required, but only ${length} present`; throw new TypeError(errMsg); } } @@ -818,7 +818,7 @@ function createDictionaryConverter(name, ...dictionaries) { } else if (member.required) { throw makeException( TypeError, - `can not be converted to '${name}' because '${key}' is required in '${name}'.`, + `can not be converted to '${name}' because '${key}' is required in '${name}'`, prefix, context, ); @@ -845,7 +845,7 @@ function createEnumConverter(name, values) { throw new TypeError( `${ prefix ? prefix + ": " : "" - }The provided value '${S}' is not a valid enum value of type ${name}.`, + }The provided value '${S}' is not a valid enum value of type ${name}`, ); } @@ -925,7 +925,7 @@ function createRecordConverter(keyConverter, valueConverter) { if (type(V) !== "Object") { throw makeException( TypeError, - "can not be converted to dictionary.", + "can not be converted to dictionary", prefix, context, ); @@ -996,7 +996,7 @@ function createInterfaceConverter(name, prototype) { if (!ObjectPrototypeIsPrototypeOf(prototype, V) || V[brand] !== brand) { throw makeException( TypeError, - `is not of type ${name}.`, + `is not of type ${name}`, prefix, context, ); diff --git a/tests/testdata/run/error_009_extensions_error.js.out b/tests/testdata/run/error_009_extensions_error.js.out index 0fd1306de72851..2ed936643a5a6b 100644 --- a/tests/testdata/run/error_009_extensions_error.js.out +++ b/tests/testdata/run/error_009_extensions_error.js.out @@ -1,4 +1,4 @@ -[WILDCARD]error: Uncaught (in promise) TypeError: Failed to construct 'Event': 1 argument required, but only 0 present. +[WILDCARD]error: Uncaught (in promise) TypeError: Failed to construct 'Event': 1 argument required, but only 0 present new Event(); ^ at [WILDCARD]