Why does my entire app crash when client.login fails?
try {
client.login(process.env.DISCORD_BOT_TOKEN);
} catch (err) {
console.error('failed to login to discordfailed to login to discord', err);
reject(err);
}
trying to login to discord through my website. If the client.login fails (because discord reset my token for the 10th time), then the entire website crashes. I'm trying to catch the error, but it doesn't catch it, it just crashes the whole app. how do i avoid that?
djs 14.7.1
4 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPthis never fires either
client.on('error', (err) => {
console.error('discord client error', err);
reject(err);
});
You didn't await your
client.login()
yup that seems to fix