All examples in Wix Code that use catch, use the .then/.catch syntax. But since many of us are now using aync/await instead, that .catch-syntax no longer applies. I found many solutions, but I am sharing the solution that I found most elegant:
Example FIND:
const objEmailList = await wixData.query("xEmails")
.eq("title", email)
.find(options)
.catch((err) => {
console.log('fnChkUnSubscribe: error in fetching emails:' + err);
});
Example BulkInsert:
let objResult = await wixData.bulkUpdate("xEmails", arrUpdate, options).catch((err) => {
console.log('fnConfirmUnsubscribe: error in bulkupdating emails:' + err);
});
And remember: you NEED a catch in every db-action (I found out the hard way). At least Site Monitor will give you clear info on what went wrong and where.