From 0135717854b48ef2dc6050a9998167f146adf8ea Mon Sep 17 00:00:00 2001 From: Essem Date: Fri, 22 Jul 2022 18:50:40 -0500 Subject: [PATCH] Another try at error logging --- events/interactionCreate.js | 2 +- events/messageCreate.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/events/interactionCreate.js b/events/interactionCreate.js index 4c5cdcd..f80f2cf 100644 --- a/events/interactionCreate.js +++ b/events/interactionCreate.js @@ -57,7 +57,7 @@ export default async (client, cluster, worker, ipc, interaction) => { } else if (error.toString().includes("Timed out")) { await interaction[replyMethod]("The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size."); } else { - logger.error(`Error occurred with slash command ${command} with arguments ${JSON.stringify(interaction.data.options)}: ${typeof error === "object" ? JSON.stringify(error) : error.toString()}`); + logger.error(`Error occurred with slash command ${command} with arguments ${JSON.stringify(interaction.data.options)}: ${error.stack || error}`); try { await interaction[replyMethod]("Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: ", { file: `Message: ${await clean(error)}\n\nStack Trace: ${await clean(error.stack)}`, diff --git a/events/messageCreate.js b/events/messageCreate.js index 187598f..c40da0e 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -153,7 +153,7 @@ export default async (client, cluster, worker, ipc, message) => { content: "The request timed out before I could download that image. Try uploading your image somewhere else or reducing its size." }, reference)); } else { - _error(`Error occurred with command message ${message.cleanContent}: ${typeof error === "object" ? JSON.stringify(error) : error.toString()}`); + _error(`Error occurred with command message ${message.cleanContent}: ${error.stack || error}`); try { await client.createMessage(message.channel.id, Object.assign({ content: "Uh oh! I ran into an error while running this command. Please report the content of the attached file at the following link or on the esmBot Support server: "