Handle almost all of the promise rejections

fixes #7
This commit is contained in:
Wroclaw 2023-07-31 12:17:14 +02:00
parent cf3102cbc5
commit 5a116b0531
4 changed files with 17 additions and 15 deletions

View file

@ -36,7 +36,7 @@ export default class CommandManager {
color: 0xff0000,
description: `Failed to perform interaction:\n\`${e}\``,
}]
}).catch(() => {/* GRACEFAIL: We're still logging the issue that happened to the console */});
}).catch(() => {/* NOTE: We're still logging the issue that happened to the console */});
console.error(`Failed to perform interaction: ${interaction.commandName}`);
console.error(e);
});
@ -46,7 +46,10 @@ export default class CommandManager {
const foundCommand = this.commands.find((command) => command.name === interaction.commandName );
if (!foundCommand) throw new Error(`Unknown command received (${interaction.commandName}). Did you forgot to push updated commands?`);
if (!foundCommand.autocomplete) return;
foundCommand.autocomplete(interaction);
foundCommand.autocomplete(interaction).catch(e => {
console.error(`Failed to perform autocomplete interaction: ${interaction.commandName}`);
console.error(e);
});
return;
}
}