Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda