How to re-iterate block run in workflow without error handler

Hi guys,
I need to re-run the block one more time in 30 seconds if it returns "file": null.

I can use such behavior using error handler, but I don't get an error in response in my case.

So I can see two available options:

  1. Re-run the block in 30 seconds even if it doesn't return an error
  2. Set up a delay between two blocks executions like setTimeout() function.

Do you have any ideas how to do that?

What about defining the rest query in a function then calling it within js block? In the js block you can evaluate the response and throw an Error. Then you can setup your retry settings on the js block.
Screenshot 2023-10-06 at 10.25.27 AM

Great idea, matth! Thank you!
Could you drop a line of code how to catch an Error with function? Sorry for maybe a newbie question.

I'm kinda a js newbie but I tried something like this

and logs look good to me. I just had another workflow as my callAPI and that was randomly returning 1 or 2
Screenshot 2023-10-06 at 11.52.51 AM

1 Like

Great! Thank you! Looks like it is a solution!
Thank you one more time!

1 Like