Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

53
Views
Stop the wrest of the javascript code when it encounters a error without stopping the entire bot

Hello im running a discord.js bot in version 12 and I want it so if it encounters a error it stops the rest of that command from running without stopping the entire bot it self this is my current code:

        async function startApp () {
            const currentUser = await noblox.setCookie(args.join(" "))
            .catch( (err) => { 
                message.channel.send("Invaild or Expired data")
                }) 
// rest of the program
7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

You would have to do

process.on("uncaughtException", console.error);

in the index of your bot. This would log any error without stopping the bot, no matter the error (provided you don't do process.exit() somewhere in your bot).

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs