cancel
Showing results for 
Search instead for 
Did you mean: 

Do not break foreach loop when API fails

bhavesh-patel
Deputy Chef III
Deputy Chef III

Issue is inside custom connector ruby code.

Context: I have a list of companies in an array then I am using .each method to loop every company and then hitting an api call on every company.

Problem: Now one api call is failed for a company and code breaks. I don't want code to break, instead I want loop to continue as we use try catch in many languages to prevent breaking of loop. How to acheive the same in Custom Connector SDK using ruby.

2 ACCEPTED SOLUTIONS

Ruby exception handling is unfortunately also not supported in the SDK-Code.

View solution in original post

There is no support for exception handling so I have move this code on the recipe level and then I used repeat action in a parent recipe on my company array and then every action goes to a child recipe where I use monitor block of recipe to handle exception from API. Then I move every error into lookup table.

View solution in original post

5 REPLIES 5

There is no support for exception handling so I have move this code on the recipe level and then I used repeat action in a parent recipe on my company array and then every action goes to a child recipe where I use monitor block of recipe to handle exception from API. Then I move every error into lookup table.