Re: WebIDL generated TypeErrors and promises

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?

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);
     { toString: function() { throw "xyz"; } }

I think this behavior is perfectly reasonable, for what it's worth...


Received on Friday, 28 June 2013 14:56:28 UTC