- From: Boris Zbarsky <bzbarsky@MIT.EDU>
- Date: Fri, 28 Jun 2013 10:55:58 -0400
- To: public-script-coord@w3.org
On 6/28/13 10:44 AM, Marcos Caceres wrote:
> When using a method that vends a promise, it's not clear to me what should happen when WebIDL says to throw a TypeError.
>
> Like, given:
>
> interface Foo{
> Promise bar(object obj);
> };
>
> //Does this throw a TypeError
> //or is boo called with the TypeError?
> fooInstance.bar(123).then(yay,boo);
Per current spec it throws a TypeError.
Just like it throws if called on the wrong this object, say.
And just like it would throw if you had:
interface Foo {
Promise bar(DOMString str);
};
fooInstance.bar(
{ toString: function() { throw "xyz"; } }
).then(whatever);
I think this behavior is perfectly reasonable, for what it's worth...
-Boris
Received on Friday, 28 June 2013 14:56:28 UTC