fix: wrap escalation email in try/catch

This commit is contained in:
2026-04-04 03:19:52 +00:00
parent 1496a96274
commit 5b6d532661

View File

@@ -149,13 +149,17 @@ async function runEscalation(interaction, ticket, nextTier, reason) {
}); });
if (!isDiscordTicket && ticket.gmailThreadId) { if (!isDiscordTicket && ticket.gmailThreadId) {
const emailBody = CONFIG.ESCALATION_MESSAGE.replace(/\{support_name\}/g, CONFIG.SUPPORT_NAME) + (reason ? `\n\nReason: ${reason}` : ''); try {
await sendTicketNotificationEmail( const emailBody = CONFIG.ESCALATION_MESSAGE.replace(/\{support_name\}/g, CONFIG.SUPPORT_NAME) + (reason ? `\n\nReason: ${reason}` : '');
ticket, await sendTicketNotificationEmail(
`Ticket escalated to ${nextTier === 1 ? 'tier 2' : 'tier 3'}`, ticket,
emailBody, `Ticket escalated to ${nextTier === 1 ? 'tier 2' : 'tier 3'}`,
interaction.member?.displayName || interaction.user.username emailBody,
); interaction.member?.displayName || interaction.user.username
);
} catch (emailErr) {
console.error('Escalation email failed (non-fatal):', emailErr.message);
}
} }
if (nextTier === 2 && ticket.welcomeMessageId) { if (nextTier === 2 && ticket.welcomeMessageId) {