diff --git a/src/main.js b/src/main.js index 6e05986..1e0c5a7 100755 --- a/src/main.js +++ b/src/main.js @@ -10,7 +10,7 @@ global.dClient = new Discord.Client({ disableEveryone: true }); { let webhook = new Discord.WebhookClient(config.webhooks.error[0], config.webhooks.error[1]); global.onError = function logError(error) { - let msg = error.stack || error.message || error; + let msg = error && (error.stack || error.message || error); console.error(msg); try { webhook.send(`\`\`\`\n${msg}\n\`\`\``).catch(()=>{}); @@ -47,4 +47,4 @@ dClient.once('ready', () => { require('./screenshotter'); require('./misc'); -}); \ No newline at end of file +});