Closed
Description
If an interface defines a Promise-returning operation with required arguments, the generated wrapper throws TypeError if insufficient number of arguments are provided. I believe the expected behavior is to return a Promise.reject that throws.
E.g.
interface Foo {
Promise<string> greet(string name);
};
Generates:
Foo.prototype.greet = function greet(name) {
...
if (arguments.length < 1) {
throw new TypeError(
"Failed to execute 'greet' on 'Foo': " + "1 argument required, but only " + arguments.length + " present."
); // [*]
}
...
}
[*] should be:
return Promise.reject(new TypeError("<error message>"));
I couldn't find exact wording in WebIDL spec about this. However, the return-rejected-promise behavior is what Web Platform Test's idlharness.js enforces.
Metadata
Metadata
Assignees
Labels
No labels