🚸 better throw new Error handling
This commit is contained in:
parent
518ec431d8
commit
ddc43cf509
2 changed files with 9 additions and 3 deletions
|
@ -6,6 +6,7 @@ import logger from "@logger";
|
|||
import deferReply from "@root/helpers/deferReply";
|
||||
import getEmbedConfig from "@helpers/getEmbedConfig";
|
||||
import getCommandMetadata from "@helpers/getCommandMetadata";
|
||||
import capitalizeFirstLetter from "@helpers/capitalizeFirstLetter";
|
||||
|
||||
export default async (interaction: CommandInteraction) => {
|
||||
if (!interaction.isCommand()) return;
|
||||
|
@ -89,10 +90,12 @@ export default async (interaction: CommandInteraction) => {
|
|||
return interaction.editReply({
|
||||
embeds: [
|
||||
new MessageEmbed()
|
||||
.setTitle("Error")
|
||||
.setDescription(
|
||||
`There was an error executing the command: **${currentCommand?.data?.name}**.`
|
||||
.setTitle(
|
||||
`[:x:] ${capitalizeFirstLetter(
|
||||
interaction.options.getSubcommand()
|
||||
)}`
|
||||
)
|
||||
.setDescription(`${"``"}${error}${"``"}`)
|
||||
.setColor(errorColor)
|
||||
.setTimestamp(new Date())
|
||||
.setFooter({ text: footerText, iconURL: footerIcon }),
|
||||
|
|
3
src/helpers/capitalizeFirstLetter.ts
Normal file
3
src/helpers/capitalizeFirstLetter.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export default (text: string): string => {
|
||||
return text.charAt(0).toUpperCase() + text.slice(1);
|
||||
};
|
Loading…
Add table
Reference in a new issue