Open
Description
It seems like finally is missing from Promise prototype. It should be fairly easy to implement as
Promise.prototype.finally = function (f) {
return this.then(
(x) => Promise.resolve(f()).then(() => x),
(x) => Promise.resolve(f()).then(() => Promise.reject(x))
);
};
finally is called if the original promise resolves or rejects, and does not affect what is passed on in the chain, unless the finally callback throws/rejects.
BTW, there is still a problem with the promise chain, see #2227
Metadata
Assignees
Labels
No labels