001package org.gbif.utils.file;
002
003/**
004 * Interface that extends the ClosableIterator providing a means to check if there is an error, log what it is, store
005 * the actual Exception, and skip over it to continue reading.
006 *
007 * @param <T> the type of elements returned by the iterator
008 */
009public interface ClosableReportingIterator<T> extends ClosableIterator<T> {
010
011  /**
012   * Return true if an error was encountered while iterating over row.
013   */
014  boolean hasRowError();
015
016  /**
017   * Return an informative message about the error encountered while iterating over row.
018   * Different from the Exception's message, used to store the row number, row string, etc.
019   */
020  String getErrorMessage();
021
022  /**
023   * Return the Exception encountered while iterating over row.
024   */
025  Exception getException();
026}