Updated error handling
This commit is contained in:
@@ -41,12 +41,11 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
await button.execute(interaction)
|
||||
} catch (error) {
|
||||
if (process.env.NODE_ENV !== "dev") {
|
||||
|
||||
await logToChannel("error", {
|
||||
embeds: [
|
||||
{
|
||||
title: "Button error occured",
|
||||
description: String(error),
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
@@ -59,11 +58,24 @@ export default function loadButtonEvents(client: Client, ft: FileType) {
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this event!",
|
||||
ephemeral: true,
|
||||
})
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button!",
|
||||
color: embedColor,
|
||||
}],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this button! 2",
|
||||
color: embedColor,
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
embeds: [
|
||||
{
|
||||
title: "Command error occured",
|
||||
description: String(error),
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
@@ -61,10 +61,22 @@ export default function loadSlashCommandsEvents(client: Client, ft: FileType) {
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this command!",
|
||||
ephemeral: true,
|
||||
})
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
}],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this command!",
|
||||
color: embedColor,
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
embeds: [
|
||||
{
|
||||
title: "Contextmenu error occured",
|
||||
description: String(error),
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
@@ -66,11 +66,24 @@ export default function loadContextMenuEvents(client: Client, ft: FileType) {
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this command!",
|
||||
ephemeral: true,
|
||||
})
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
}],
|
||||
ephemeral: true,
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this contextmenu command!",
|
||||
color: embedColor,
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
embeds: [
|
||||
{
|
||||
title: "Button error occured",
|
||||
description: String(error),
|
||||
description: "```" + error + "```",
|
||||
color: embedColor,
|
||||
footer: {
|
||||
icon_url: interaction.guild!.iconURL() || undefined,
|
||||
@@ -60,11 +60,23 @@ export default function loadModalEvents(client: Client, ft: FileType) {
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
console.error(error)
|
||||
await interaction.reply({
|
||||
content: "There was an error while executing this modal!",
|
||||
ephemeral: true,
|
||||
})
|
||||
if (!interaction.deferred) {
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
} else {
|
||||
await interaction.editReply({
|
||||
embeds: [{
|
||||
description: "There was an error while executing this modal!",
|
||||
color: embedColor
|
||||
}]
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user