I need to catch an error from a third party library.
(async () => {
try {
var response = await func_1();
console.log("should not show this");
}
catch (err) {
console.log("should show this", err);
}
async function func_1() {
func_2();
}
async function func_2() {
func_N();
}
async function func_N() {
throw new Error("oops");
}
})();
So I need to catch func_N error in try catch but becuase func_N is async and it's called by some functions without await the try catch doesn't catch the error.
So is there any way to do this?