I’m digging into the node 7 async/await feature and keep stumbling across code like this
function getQuote() {
let quote = "Lorem ipsum dolor sit amet, consectetur adipiscing elit laborum.";
return quote;
}
async function main() {
try {
var quote = await getQuote();
console.log(quote);
} catch (error) {
console.error(error);
}
}
main();
This seems to be the only possibility resolve/reject or return/throw with async/await, however, v8 doesn’t optimise code within try/catch blocks?!
Are there alternatives?