Skip to content

Commit

Permalink
refactor(ext/webidl): align error messages (#25625)
Browse files Browse the repository at this point in the history
Towards #25269
  • Loading branch information
irbull authored Sep 19, 2024
1 parent 0ea71ab commit 3035cdd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions ext/webidl/00_webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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,
);
Expand All @@ -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}`,
);
}

Expand Down Expand Up @@ -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,
);
Expand Down Expand Up @@ -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,
);
Expand Down
2 changes: 1 addition & 1 deletion tests/testdata/run/error_009_extensions_error.js.out
Original file line number Diff line number Diff line change
@@ -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]
Expand Down

0 comments on commit 3035cdd

Please sign in to comment.