Handling errors from iterators