Trigger `catch`/`finally` with rejected `return` promise in `async` functions

Claude Pache claude.pache at
Mon Sep 10 10:03:45 UTC 2018

> Le 9 sept. 2018 à 23:49, Isiah Meadows <isiahmeadows at> a écrit :
> Does `return foo` not seemingly imply the implicit unwrapping is
> occuring *inside* the function?

For me, no. If I want to await the resolution of the promise `foo` before handling the `catch` or the `finally` block, I expect to add an explicit `await`.

”Intuition” may vary among people. I think that, in general, it is better to use the more objective notion of ”regularity”, which is, in this case: ”Always use an explicit `await` (or `Promise.all`, etc.) if, at this point of the program, you want to await the resolution.”


More information about the es-discuss mailing list