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]);
|
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(()=>{});
|
||||||
|
|
Loading…
Reference in New Issue