Add try/catch to command execution #173
2 changed files with 14 additions and 2 deletions
|
@ -12,6 +12,12 @@ export default class Button {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
item.Event.execute(interaction);
|
item.Event.execute(interaction);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
|
||||||
|
await interaction.reply("An error occurred while executing the event");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,6 +22,12 @@ export default class ChatInputCommand {
|
||||||
itemToUse = itemForServer;
|
itemToUse = itemForServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
itemToUse.Command.execute(interaction);
|
itemToUse.Command.execute(interaction);
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
|
||||||
|
await interaction.reply("An error occurred while executing the command");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue