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?