gotchaMajorpending
Async void functions silently swallow exceptions
Viewed 0 times
async voidunhandled rejectionPromise voidexception swallowed
nodejsbrowser
Error Messages
Problem
Async functions returning void (not Promise) silently lose exceptions. Errors cause unhandled rejections and cannot be awaited.
Solution
Always return Promise<void> in JS/TS or Task in C#. If you need to not await, catch errors explicitly: promise.catch(logger.error).
Why
Async void has no way to report errors to the caller. Exceptions become unhandled rejections.
Revisions (0)
No revisions yet.