[Bug 26517] Methods that return promises are unable to throw exceptions

https://www.w3.org/Bugs/Public/show_bug.cgi?id=26517

--- Comment #9 from Tab Atkins Jr. <jackalmage@gmail.com> ---
(In reply to Marcos Caceres from comment #8)
> (In reply to Ian 'Hixie' Hickson from comment #7)
> > I would much rather
> > be able to write:
> > 
> >    Promise<Foo> bar();
> > 
> > ...than have to write:
> > 
> >    interface Whatever { };
> >    typedef (Promise<Foo> or Whatever) PromiseFoo;
> > 
> >    PromiseFoo bar();
> > 
> > ...which is what I'm currently forced to do to describe APIs that throw in
> > certain cases and return promises when they don't throw.
> 
> IIUC, what we are trying to agree on is what model we use for the Web (what
> the web used from the beginning of time or this new model that is currently
> in WebIDL - or something in between, where there is a very good reason to
> not have the promise handle the error through rejection). If you've managed
> to cleverly hack around it using a typedef doesn't really address the core
> problem - as whatever API you put that on may be rejected by implementers
> unless we get agreement on the idiom to use.

Indeed. I'll strongly recommend not implementing such a pattern to any
implementors of a feature you write that for; it's clumsy and won't match the
rest of the platform.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Received on Tuesday, 5 August 2014 20:13:07 UTC