From 234fd0840491d5003c390dded70cd15991ef24df Mon Sep 17 00:00:00 2001 From: C-Doug-iS <58091538+C-Doug-iS@users.noreply.github.com> Date: Tue, 26 Apr 2022 11:12:22 -0400 Subject: [PATCH] Fixing ReferenceError in catch block Sending error to channel results in a ReferenceError because cleaned is not defined in the catch block's scope. Replaced with sending the error's stack to resolve this. --- examples/making-an-eval-command.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/making-an-eval-command.md b/examples/making-an-eval-command.md index e014ad5..d216dcd 100644 --- a/examples/making-an-eval-command.md +++ b/examples/making-an-eval-command.md @@ -109,7 +109,7 @@ client.on("messageCreate", async (message) => { message.channel.send(`\`\`\`js\n${cleaned}\n\`\`\``); } catch (err) { // Reply in the channel with our error - message.channel.send(`\`ERROR\` \`\`\`xl\n${cleaned}\n\`\`\``); + message.channel.send(`\`ERROR\` \`\`\`xl\n${err.stack}\n\`\`\``); } // End of our command