forked from Galactic/galactic-bot
some improvement to error logging
This commit is contained in:
parent
dcbda13b2a
commit
971ea2f6f4
@ -55,12 +55,20 @@ class SlashCommandManager {
|
|||||||
try {
|
try {
|
||||||
result = await Promise.all(promises);
|
result = await Promise.all(promises);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
this.client.logger.error(
|
||||||
|
`An issue has occured while updating guild commands. Guild command refresh aborted.\n${error.stack || error}`
|
||||||
|
);
|
||||||
// Figures out which command and option ran into issues
|
// Figures out which command and option ran into issues
|
||||||
const invalid = error.rawError.errors;
|
const invalid = error.rawError.errors;
|
||||||
const keys = Object.keys(invalid);
|
const keys = Object.keys(invalid);
|
||||||
let str = '';
|
let str = '';
|
||||||
for (const key of keys) {
|
for (const key of keys) {
|
||||||
const command = commands[parseInt(key)];
|
const i = parseInt(key);
|
||||||
|
const command = commands[i];
|
||||||
|
if (!command) {
|
||||||
|
this.client.logger.warn(`Unable to select command for index ${i} (${key})`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
str += `${command.name}: `;
|
str += `${command.name}: `;
|
||||||
const options = Object.keys(invalid[key].options);
|
const options = Object.keys(invalid[key].options);
|
||||||
for (const optKey of options) {
|
for (const optKey of options) {
|
||||||
@ -68,9 +76,6 @@ class SlashCommandManager {
|
|||||||
}
|
}
|
||||||
str += `\n\n`;
|
str += `\n\n`;
|
||||||
}
|
}
|
||||||
this.client.logger.error(
|
|
||||||
`An issue has occured while updating guild commands. Guild command refresh aborted.\n${error.stack || error}`
|
|
||||||
);
|
|
||||||
this.client.logger.error(`Failed commands:\n${str}`);
|
this.client.logger.error(`Failed commands:\n${str}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user