3 ms·
I have encounter this problem https://stackoverflow.com/questions/28708238/catching-exceptions-in-async-code-called-synchronously https://stackoverflow.com/ques
by lukasm 12y ago
I have encounter this problem https://stackoverflow.com/questions/28708238/catching-exceptions-in-async-code-called-synchronously https://stackoverflow.com/questions/28708238/catching-except...
Basically, it's hard and prone to bugs.
- TheCoreh 12y agoThe implementation in JS seems to be simpler and consequently less error prone than the one in C#. Calling an async function just returns a Promise. The await operator just yields to the event loop until a given Promise is fullfilled. Exceptions are handled "normally" inside the async function with try/catch, outside they're handled with a callback, like in existing code that uses promises.