Closed Bug 977395 Opened 10 years ago Closed 10 years ago

Add promise.catch

Categories

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

defect

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: bbenvie, Unassigned)

References

Details

(Whiteboard: [good first bug])

DOM Promises have a "catch" method on Promise.prototype. Despite add-on sdk promises being deprecated, we'd like to have API parity. We're also adding "catch" to Promise.jsm as part of bug 941920.

"catch" is simply implemented as `return this.then(undefined, onReject)`.
Blocks: 988075
No longer blocks: 941920
Depends on: 941920
fixing this bug should include a test, and probably replacing uses of: 

  promise.then(undefined, onReject);

with:

  promise.catch(onReject);

throughout the SDK code.
Whiteboard: [good first bug]
Due to bug Bug 881047, sdk/core/promise will use Promise.jsm promises, so this will be redundant once that lands.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Don't we still need to do this, just not in the addon-sdk?
Flags: needinfo?(jsantell)
For Promise.jsm? Doesn't bug 941920 address that?
Flags: needinfo?(jsantell)
(In reply to Jordan Santell [:jsantell] [@jsantell] from comment #4)
> For Promise.jsm? Doesn't bug 941920 address that?

No, for the remaining devtools code that hasn't been ported to use Promise.jsm. Promises from that code will be missing a .catch method, so we can't reliably use it everywhere unless we're sure of the source of a promise.
Ah, in that case we should probably just do it in the copied promise code in devtools after bug 995184.
Status: RESOLVED → REOPENED
Depends on: 995184
Resolution: DUPLICATE → ---
this is resolved right?
Flags: needinfo?(jsantell)
This would be referring to the old sync SDK promises which are no longer in the SDK, but still exist in some components of devtools:
https://github.com/mozilla/gecko-dev/blob/master/toolkit/devtools/deprecated-sync-thenables.js

Not sure it's worthwhile to add, although unsure where all these consumers of this are -- either way, this would be a dev tools bug, not an SDK bug.
Flags: needinfo?(jsantell)
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.