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