Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
Function still raises exception even with catch statement

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()
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda