mailer: handle error at the caller instead

the send test email logic breaks if we disable throwing error in send
This commit is contained in:
Girish Ramakrishnan
2025-08-06 10:18:05 +02:00
parent 5c7d19ce13
commit c184f1e42e
3 changed files with 12 additions and 11 deletions

View File

@@ -75,8 +75,8 @@ async function sendMail(mailOptions) {
});
const [error] = await safe(transport.sendMail(mailOptions));
if (error) debug(`Error sending Email "${mailOptions.subject}" to ${mailOptions.to}: ${error.message}`);
else debug(`Email "${mailOptions.subject}" sent to ${mailOptions.to}`);
if (error) throw new BoxError(BoxError.EXTERNAL_ERROR, `Error sending Email "${mailOptions.subject}" to ${mailOptions.to}: ${error.message}`);
debug(`Email "${mailOptions.subject}" sent to ${mailOptions.to}`);
}
function render(templateFile, params, translationAssets) {