Uitzonderingen in synchrone stijl in JavaScript
De synchrone syntaxis van promises ondersteunt
uitzonderingsafhandeling via de gebruikelijke try-catch:
async function func() {
try {
let res = await getSmth(2);
console.log(res);
} catch (err) {
console.log(err);
}
}
func();