Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$q's finally documentation is not consistent with implementation #9291

Closed
shahata opened this issue Sep 26, 2014 · 4 comments
Closed

$q's finally documentation is not consistent with implementation #9291

shahata opened this issue Sep 26, 2014 · 4 comments

Comments

@shahata
Copy link
Contributor

shahata commented Sep 26, 2014

The docs say that finally "allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value".

However, the truth is that if the finally callback throws an exception or returns a promise that later gets rejected, the original promise will be rejected with that exception/reason.

The question is whether we should fix the doc or change the implementation in order match the semantics of Q's finally (which will obviously be a breaking change)...

@shahata
Copy link
Contributor Author

shahata commented Sep 26, 2014

This behavior exists since finally was added in #2424. I couldn't find any reason for the inconsistency.

@jeffbcross
Copy link
Contributor

Are there compelling use cases that would justify a breaking change? I'd prefer to just update the docs.

@jeffbcross jeffbcross added this to the 1.3.0 milestone Sep 26, 2014
@shahata
Copy link
Contributor Author

shahata commented Sep 26, 2014

The only reason to change it is that it is not consistent with Q and is pretty confusing (Q's implementation makes much more sense imo). I agree it is probably not worth the breaking change though.

@gkalpak
Copy link
Member

gkalpak commented Aug 22, 2016

I don't what the case was in 2014, but Q does the same things now. In our docs we link to the Q API docs for more info, where it is stated that:

[...]
finally returns a promise, which will become resolved with the same fulfillment value or rejection reason as promise. However, if callback returns a promise, the resolution of the returned promise will be delayed until the promise returned from callback is finished. Furthermore, if the returned promise rejects, that rejection will be passed down the chain instead of the previous result.

Afaict, this can be closed. (Feel free to reopen or comment below in case I missed something.)

@gkalpak gkalpak closed this as completed Aug 22, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants