I need to log the exception message if any conversion exception comes while iterating data of a file and then continue with next data.
For example, if the input file has 10 records and there is exception raised due to 7th record. Then I need to yield return Rows for 1-6 and 8-10, along with logging exception for 7th record.
I am using the following code to yield rows using data of a file:
public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
{
using (FileEngine file = FluentFile.For<SomeDataRecordETL>().From(FilePath))
{
foreach (object obj in file)
{
yield return Row.FromObject(obj);
}
}
}