refactor: update command tests to use require syntax and improve error handling
Deploy to NAS / deploy (push) Successful in 1m4s
Deploy to NAS / deploy (push) Successful in 1m4s
This commit is contained in:
+3
-3
@@ -34,7 +34,7 @@ export default class Command {
|
||||
this._logger.info(`Executing command: ${interaction.commandName}`);
|
||||
await this.run(interaction);
|
||||
} catch (error) {
|
||||
this.handleError(interaction, error);
|
||||
await this.handleError(interaction, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,13 +44,13 @@ export default class Command {
|
||||
}
|
||||
|
||||
// Standardized error handling
|
||||
handleError(interaction, error) {
|
||||
async handleError(interaction, error) {
|
||||
this._logger.error(`Command ${interaction.commandName} failed:`, error);
|
||||
|
||||
const response = interaction.deferred ? 'followUp' : 'reply';
|
||||
const errorMessage = this.getErrorMessage(error);
|
||||
|
||||
interaction[response]({
|
||||
await interaction[response]({
|
||||
content: errorMessage,
|
||||
ephemeral: true,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user