W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2014

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

From: <bugzilla@jessica.w3.org>
Date: Tue, 05 Aug 2014 20:13:06 +0000
To: public-script-coord@w3.org
Message-ID: <bug-26517-3890-xzB6Ddxgvc@http.www.w3.org/Bugs/Public/>
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

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:22 UTC