getdata()
.then(data => {
functionThatMightThrow(data);
})
.catch(error => {
console.log(error);
});
getdata()
.then(data => {
functionThatMightThrow(data);
})
.catch(error => {
// One option (more noisy than console.log):
console.error(error);
// Another option:
notifyUserOfError(error);
// Another option:
reportErrorToService(error);
// OR do all three!
});