Opened 5 years ago

Closed 3 years ago

#18384 closed enhancement (patchwelcome)

Add .finally() to Promises

Reported by: MikeMacCS Owned by:
Priority: undecided Milestone: 1.13
Component: Core Version: 1.10.2
Keywords: Cc:
Blocked By: Blocking:

Description

It's common to want to perform some simple bookkeeping after a promise resolves, but not want to interfere with the regular flow of the promise chain. I think dojo/Promise/promise should incorporate something similar to Q's finally() method, which behaves like .always(), but resolves or rejects the resulting promise with the resolved or rejected value of the initiating promise.

See: https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback

Change History (5)

comment:1 Changed 5 years ago by tupton

The discussion on #17211 is also relevant. If always is intentionally not propagating errors then finally is useful when you don't want to interfere with the flow of either the callback or errback chain (and not have to worry about which path arrived at finally.)

comment:2 Changed 5 years ago by MikeMacCS

I have some simple code that accomplishes this nicely. I'm waiting on the corporate CLA to be signed before I can submit it for the next version.

comment:3 Changed 5 years ago by MikeMacCS

Corporate CLA submitted, and PR has been submitted to Github Repo

comment:4 Changed 4 years ago by dylan

Milestone: tbd1.12

comment:5 Changed 3 years ago by dylan

Resolution: patchwelcome
Status: newclosed

I closed the corresponding PR because it is stale/conflicting, and agreement was unfortunately never achieved on this change. Closing as patchwelcome (which may seem a bit disingenuous, but meaning we would need a new PR and agreement on any change).

Note: See TracTickets for help on using tickets.