Javascript – How to handle unexpected errors thrown inside an async function?
Let's say there's an async function that has an implementation bug, for example: function resolveAfter2Seconds() { return new Promise((resolve) => { setTimeout(() => { resolve(undefined_variable); }, 2000); }); } How can I call this function and handle the ReferenceError it…