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
d.js toolkit
d.js toolkit13mo ago
- 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 OP
skeddles
skeddlesOP13mo ago
this never fires either client.on('error', (err) => { console.error('discord client error', err); reject(err); });
Syjalo
Syjalo13mo ago
You didn't await your client.login()
skeddles
skeddlesOP13mo ago
yup that seems to fix
Want results from more Discord servers?
Add your server