0

Im suffering from a weird issue

basically I have the function

msg.guild.members.unban(userID)

This function returns a promise

I then use a .then statement for further code after the promise has been fulfilled

msg.guild.members.unban(element)
         .then(function() {console.log("worked")})

Anyways this function will in certain cases raise an Exception

Therefore I use the .catch statement to handle it

msg.guild.members.unban(element)
         .catch(console.log("Not banned"))
         .then(function() {})

However this does not seem to work

as a discord api error will still be raised and the program terminated

The error is an DiscordAPIError

Even if I remove the .then statement and just have a catch statement the program is still terminated

msg.guild.members.unban(element)
   .catch()
Furious
  • 63
  • 2
  • 10

0 Answers0