Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!