Closed Bug 851321 Opened 11 years ago Closed 10 years ago

Implement Q like promise.done()

Categories

(Add-on SDK Graveyard :: General, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: evold, Unassigned)

References

Details

Promise.and() would log errors in the console and not take a 2nd argument, unlike Promise.then().

Usage would be like so:

promise.then(a).then(b).and(c);

which would log an error in a, b or c
We need to implement .done() method similar to one that Q has. It's documented
in details here:

http://documentup.com/kriskowal/q/#tutorial/the-end
Summary: Implement promise.and() → Implement Q like promise.done()
Assignee: nobody → jsantell
From the document you linked: « This is a stopgap. We are exploring ways to make unhandled errors visible without any explicit handling. »
See also bug 766078 for a possible implementation strategy. For debugging mode only, of course.
Note that setting

    promise._reportErrors = true;

Allows a degree of error reporting by default that seems to be working OK for us right now.

Not saying that .done(); isn't useful, just that we're not shouting for it as much.
The current promises implementation is based off of the extremely large Q, and implementing done would require a lot of rewriting -- currently investigating other Promise implementations to leverage rather than pulling out subsets from Q when we need to add a new feature (rsvp, when), while keeping the current API.
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #6)
> The current promises implementation is based off of the extremely large Q,
> and implementing done would require a lot of rewriting -- currently
> investigating other Promise implementations to leverage rather than pulling
> out subsets from Q when we need to add a new feature (rsvp, when), while
> keeping the current API.

It's code looks a lot closer to "when" to me. Irakli?
Whiteboard: [good first bug]
Assignee: jsantell → nobody
Hard to believe this is a [good first bug]
Anyway, the whole module is deprecated.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Whiteboard: [good first bug]
You need to log in before you can comment on or make changes to this bug.