fix: wrap escalation email in try/catch
This commit is contained in:
@@ -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) {
|
||||||
@@ -1204,4 +1208,4 @@ async function handleAutocomplete(interaction) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { handleCommand, handleContextMenu, handleAutocomplete, runEscalation, runDeescalation };
|
module.exports = { handleCommand, handleContextMenu, handleAutocomplete, runEscalation, runDeescalation };
|
||||||
Reference in New Issue
Block a user