DEV Community

Discussion on: Finally in Promises & Try/Catch

Collapse
 
kurisutofu profile image
kurisutofu

When I saw the code for try-catch-finally, my first thought was that you should not have a "return" in the try and catch if you are using finally.
My understanding was that finally has the "final say".

I find interesting the way promises handle that. Which I think makes sense too ... each action "block" would basically be a local try-catch-finally except the "catches" are grouped at the end for handling.

Collapse
 
annarankin profile image
Anna Rankin

Sorry I missed your comment - I agree, the multiple returns with the catch block are pretty wacky. The way Promises work makes sense looking at it now, but my brain totally rebelled on first look 😵Thanks kuristofu!