enh: discord error reporting

This commit is contained in:
Ben Allfree 2024-09-23 05:56:39 -07:00
parent 430495387f
commit dbfc49e4b5

View File

@ -6,7 +6,7 @@ const cache: { [_: string]: NodeJS.Timeout } = {}
export const discordAlert = (message: { toString: () => string }) => {
const url = DISCORD_ALERT_CHANNEL_URL()
if (!url) return
const m = message.toString()
const m = `${message}${message instanceof Error ? `\n${message.stack}` : ''}`
const isCached = !!cache[m]
if (isCached) {
clearTimeout(cache[m])