I'm just playing around with async/await in node and it seems that if you're awaiting a promise and it gets rejected that it throws. I'm wondering if there is a cleaner pattern than going back to try/catch blocks that I'm not aware of?
async function foo() {
const val = await Promise.reject();
}
fs.accessthrows if you can't access a file, but this is the appropriate way to check if you have access).try/catchis meant for unexpected errors, not expected ones.