Apparently V8 can optimize away the redundant promise and calling await ensures the async function shows up in the stack trace.
Alternatively you can do return fn().catch((e) => ...); if you don’t like using try+catch.
return fn().catch((e) => ...);
This is especially useful in bigger function that tend to undergo refactorings. And the try/catch gotcha imo is the worst understood part of JS as of today leading to an almost one per 1000 LOC in my experience.
Apparently V8 can optimize away the redundant promise and calling await ensures the async function shows up in the stack trace.
Alternatively you can do
return fn().catch((e) => ...);if you don’t like using try+catch.This is especially useful in bigger function that tend to undergo refactorings. And the try/catch gotcha imo is the worst understood part of JS as of today leading to an almost one per 1000 LOC in my experience.