I have an async function that fails:
async function main() {
// fails
throw 'some error';
}
main();
what is the correct way to propagate this exception to end program execution?
Is this:
main().catch(err => { console.log(err); process.exit(1); });
the correct way or is there a better pattern?