3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 14:11:50 +00:00

Log in console when we crash due to too many recent errors

This commit is contained in:
Dragory 2019-04-23 05:38:48 +03:00
parent 64dd1fc9e0
commit 3b340a92c1

View file

@ -26,11 +26,17 @@ function errorHandler(err) {
if (err instanceof PluginError) { if (err instanceof PluginError) {
// Tolerate a few recent plugin errors before crashing // Tolerate a few recent plugin errors before crashing
if (++recentPluginErrors >= RECENT_PLUGIN_ERROR_EXIT_THRESHOLD) process.exit(1); if (++recentPluginErrors >= RECENT_PLUGIN_ERROR_EXIT_THRESHOLD) {
console.error(`Exiting after ${RECENT_PLUGIN_ERROR_EXIT_THRESHOLD} plugin errors`);
process.exit(1);
}
} else if (err instanceof DiscordRESTError || err instanceof DiscordHTTPError) { } else if (err instanceof DiscordRESTError || err instanceof DiscordHTTPError) {
// Discord API errors, usually safe to continue (rate limits etc. are handled elsewhere) // Discord API errors, usually safe to continue (rate limits etc. are handled elsewhere)
// We still bail if we get a ton of them in a short amount of time // We still bail if we get a ton of them in a short amount of time
if (++recentDiscordErrors >= RECENT_DISCORD_ERROR_EXIT_THRESHOLD) process.exit(1); if (++recentDiscordErrors >= RECENT_DISCORD_ERROR_EXIT_THRESHOLD) {
console.error(`Exiting after ${RECENT_DISCORD_ERROR_EXIT_THRESHOLD} API errors`);
process.exit(1);
}
} else { } else {
// On other errors, crash immediately // On other errors, crash immediately
process.exit(1); process.exit(1);