Improved error handling

This commit is contained in:
Skylar Grant 2023-02-19 19:37:56 -05:00
parent 56a75c3af5
commit b0a9a6a42c
3 changed files with 7 additions and 3 deletions

View File

@ -20,6 +20,8 @@
"embeds": {
"footer": "Silvanus is not affiliated with Grow A Tree or Limbo Labs",
"color": "0x55FF55",
"errorTitle": "Oops!",
"errorPrefix": "There seems to have been a problem.",
"waterColor": "0x5555FF",
"fruitColor": "0xCC5555",
"waterTitle": "Water Notification",
@ -48,7 +50,8 @@
"supportServer": "https://discord.gg/g5JRGn7PxU"
},
"error": {
"noGuild": "Setup has not been completed yet. Try running </setup:1065407649363005561> or </help setup:1065346941166297129>"
"noGuild": "Setup has not been completed yet. Try running </setup:1065407649363005561> or </help setup:1065346941166297129>",
"invalidSubcommand": "Invalid subcommand detected."
},
"status": {
"treeAndLeaderboard": "Tree and leaderboard messages were both found, setup is complete. Run </setupinfo:1065413032374706196> to verify. Run </compare:1065346941166297128> to get started!",

View File

@ -157,8 +157,8 @@ const functions = {
errorEmbed(content) {
const embed = new EmbedBuilder()
.setColor(0xFF0000)
.setTitle('Error!')
.setDescription("Error: " + content)
.setTitle(strings.embeds.errorTitle)
.setDescription(`${strings.embeds.errorPrefix}\n${content}`)
.setFooter({ text: `v${package.version} - ${strings.embeds.footer}` });
const messageContents = { embeds: [embed], ephemeral: true };
return messageContents;

View File

@ -88,6 +88,7 @@ module.exports = {
}
break;
default:
await interaction.editReply(fn.builders.errorEmbed(strings.error.invalidSubcommand)).catch(e => console.error(e));
break;
}
},