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": { "embeds": {
"footer": "Silvanus is not affiliated with Grow A Tree or Limbo Labs", "footer": "Silvanus is not affiliated with Grow A Tree or Limbo Labs",
"color": "0x55FF55", "color": "0x55FF55",
"errorTitle": "Oops!",
"errorPrefix": "There seems to have been a problem.",
"waterColor": "0x5555FF", "waterColor": "0x5555FF",
"fruitColor": "0xCC5555", "fruitColor": "0xCC5555",
"waterTitle": "Water Notification", "waterTitle": "Water Notification",
@ -48,7 +50,8 @@
"supportServer": "https://discord.gg/g5JRGn7PxU" "supportServer": "https://discord.gg/g5JRGn7PxU"
}, },
"error": { "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": { "status": {
"treeAndLeaderboard": "Tree and leaderboard messages were both found, setup is complete. Run </setupinfo:1065413032374706196> to verify. Run </compare:1065346941166297128> to get started!", "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) { errorEmbed(content) {
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setColor(0xFF0000) .setColor(0xFF0000)
.setTitle('Error!') .setTitle(strings.embeds.errorTitle)
.setDescription("Error: " + content) .setDescription(`${strings.embeds.errorPrefix}\n${content}`)
.setFooter({ text: `v${package.version} - ${strings.embeds.footer}` }); .setFooter({ text: `v${package.version} - ${strings.embeds.footer}` });
const messageContents = { embeds: [embed], ephemeral: true }; const messageContents = { embeds: [embed], ephemeral: true };
return messageContents; return messageContents;

View File

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