Sprints: /en-US/docs/Learn/JavaScript/Asynchronous/Promises

Created on 10 Nov 2019  路  4Comments  路  Source: mdn/sprints

Request type

  • [ ] Please close this issue, I accidentally submitted it without adding any details
  • [ ] New documentation
  • [x] Correction or update

Details

On the page _"Graceful asynchronous programming with Promises"_, the last note in the _"Running some final code after a promise fulfills/rejects"_ section says

"finally() allows you to write async equivalents to try/catch/finally in async code"

while it should be,

"finally() allows you to write async equivalents to try/catch/finally in sync code"

Most helpful comment

I believe I've fixed this now; let me know if you think it needs any more work!

All 4 comments

It depends on how you interpret it.

If you interpret it like this:

"finally() allows you to write async equivalents to async code try/catch/finally"

then yes, it's wrong.

But if you interpret it like this:

"finally() allows you to write async equivalents to try/catch/finally, but in async code"

then it's correct, although a bit redundant and confusing.

I think that this simpler sentence would make it clear enough that try/catch/finally is sync:

"finally() allows you to write async equivalents to try/catch/finally"

Three notes above that one, we can read:

.then()/.catch() blocks in promises are basically the async equivalent of a try...catch block in sync code

I find it very clear in that case, so the wording for the note I opened the issue for would be less confusing if it would follow the same format in my opinion.

Yes, absolutely.

I'm leaving screenshots from the page here so that it's easier for the admins to see it.

image
image

I believe I've fixed this now; let me know if you think it needs any more work!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arturjanc picture arturjanc  路  5Comments

Elchi3 picture Elchi3  路  8Comments

chrisdavidmills picture chrisdavidmills  路  6Comments

krankj picture krankj  路  3Comments

bershanskiy picture bershanskiy  路  4Comments