Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Fixing ReferenceError in catch block #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/making-an-eval-command.md
Original file line number Diff line number Diff line change
Expand Up @@ -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\`\`\``);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This doesn't send the actual error.
  2. err.stack is string[]? meaning it could be undefined.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. This doesn't send the actual error.
  2. err.stack is string[]? meaning it could be undefined.
  1. Error#stack does send the actual error message, plus the error stack.
  2. Technically err is of type unknown, so an instance check for Error would be appropriate here, but the chances of a non-error type being thrown is unlikely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RealShadowNova... oops; implementation issue with the way my stack system works. soz!

}

// End of our command
Expand Down