Handle undefined errors

This commit is contained in:
Lamp 2018-08-30 15:45:23 -07:00 committed by GitHub
parent f04bc6da9d
commit 660cf668e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ global.dClient = new Discord.Client({ disableEveryone: true });
{ {
let webhook = new Discord.WebhookClient(config.webhooks.error[0], config.webhooks.error[1]); let webhook = new Discord.WebhookClient(config.webhooks.error[0], config.webhooks.error[1]);
global.onError = function logError(error) { global.onError = function logError(error) {
let msg = error.stack || error.message || error; let msg = error && (error.stack || error.message || error);
console.error(msg); console.error(msg);
try { try {
webhook.send(`\`\`\`\n${msg}\n\`\`\``).catch(()=>{}); webhook.send(`\`\`\`\n${msg}\n\`\`\``).catch(()=>{});