UsulPro
06/06/2018, 1:55 PMexport default async event => {
/* ... */
sgMail.send(msgInfo)
.then(() => console.log('sgMail is sent'))
.catch((err) => console.log('sgMail error:', err))
// Or should I await until it's resolved?
// await sgMail.send(msgInfo)
// .then(() => console.log('sgMail is sent'))
// .catch((err) => console.log('sgMail error:', err))
return event;
};
may I be sure that mail will be sent without await
?Vakrim
06/06/2018, 2:47 PMawait
. So in this example you can skip await, because it only will lead to longer response time.UsulPro
06/06/2018, 2:59 PMawait
?Tatsuyuki Ishi
06/07/2018, 2:14 PMUsulPro
06/07/2018, 7:19 PMawait
executions and handle errors, not wasting response time 🤔