fbjs icon indicating copy to clipboard operation
fbjs copied to clipboard

Does Promise.prototype.finally turn rejected promise to resolved in purpose?

Open adventure-yunfei opened this issue 9 years ago • 2 comments

I just using react-native which requires the project but got this issue.

Other promise implementations like well-known bluebird or the "promise" package itself have a ".finally" which won't change the promise state. I'm not sure why here it is different.

adventure-yunfei avatar Mar 27 '16 12:03 adventure-yunfei

Can you post some code that shows this behavior?

kassens avatar Apr 06 '16 16:04 kassens

var result = thingThatFails()
  .finally((res) => { cleanUp(); return res; });

makes result a resolved promise, even if thingThatFails() returned a rejected one. It seems standard now for people to keep the resolution/rejection through a finally so we should probably switch; someone needs to look over our internal code to see if anything will break.

sophiebits avatar Apr 06 '16 17:04 sophiebits