4 ms·
I don't think this is correct, as the try catch will only catch errors that happen while returning the promise, not awaiting it; you need to do this: const
by saurik 7y ago
I don't think this is correct, as the try catch will only catch errors that happen while returning the promise, not awaiting it; you need to do this:
const result = await (async () => {
try {
return await funcThatReturnSomeType();
} catch (err) {
doSomethingWithErr(err);
}
})();
- yawaramin 7y agoYou may be right, proving the old adage that the best way to get an answer on the internet is to post a wrong answer ;-)