JS
See the Pen thecodelog.com - ES8 Async Functions 1 by Deano (@deangilewicz) on CodePen.
await is only valid in an async function otherwise you will get a SyntaxError.
See the Pen thecodelog.com - ES8 Async Functions 2 by Deano (@deangilewicz) on CodePen.
To handle async function errors you can use try/catch.
See the Pen thecodelog.com - ES8 Async Functions 3 by Deano (@deangilewicz) on CodePen.
Another solution to handle errors is to create a higher order function that you can use to wrap async functions.
See the Pen thecodelog.com - ES8 Async Functions 4 by Deano (@deangilewicz) on CodePen.