add error handling when iterating over items to ensure every item gets processed