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

226
Visualizações
Should I throw new error or return from if statement?

Hello I am looping through array of coins and running a setTimeout based on when a coin bid ends and running a function called automaticBid();

    setTimeout(async () => {
  // placeBid(coin, username, password)
  await placeAutomaticBid(coin.username, coin.password, coin.itemId, coin.bidAmount).catch(error => console.error(error));
  // placeTest()
}, calcTime * 1000);

in the automaticBid()

I have this logic:

    if (parseInt(minBid) - 1 > bidAmount) {
    throw new Error('Bid is less than Min bid')
  }

It throws error but breaks the whole loop. DO i need to catch the automaticBId()? or should I wrap all the logic in trycatch? How do I keep the loop running without breaking it by throwing this error? and continue on to the next coin?

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