Handle undefined errors
This commit is contained in:
parent
f04bc6da9d
commit
660cf668e4
|
@ -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');
|
||||
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue