try/except around iterator