public bool ReadingExceptionOccurred(CsvHelperException obj)
        {
            var line = new FlatFileLine(obj.ReadingContext);

            switch (_strategy)
            {
            case BadDataHandlingStrategy.IgnoreRows:
                if (_maximumErrorsToReport-- > 0)
                {
                    _listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, "Ignored ReadingException on " + line.GetLineDescription(), obj));
                }

                //move to next line
                _dataPusher.BadLines.Add(obj.ReadingContext.RawRow);

                break;

            case BadDataHandlingStrategy.DivertRows:

                DivertErrorRow(new FlatFileLine(obj.ReadingContext), obj);
                break;

            case BadDataHandlingStrategy.ThrowException:
                throw new FlatFileLoadException("Bad data found on li" + line.GetLineDescription(), obj);

            default:
                throw new ArgumentOutOfRangeException();
            }

            //todo should this return true or false? not clear, this was an API change in CSV.
            return(true);
        }
        public void BadDataFound(FlatFileLine line, bool isFromCsvHelper = false)
        {
            if (_ignoreBadDataEvents && isFromCsvHelper)
            {
                if (_maximumErrorsToReport-- > 0)
                {
                    _listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, "Ignorring CSVHelper internal bad data warning:" + line.GetLineDescription()));
                    return;
                }
            }

            switch (_strategy)
            {
            case BadDataHandlingStrategy.IgnoreRows:

                if (_maximumErrorsToReport-- > 0)
                {
                    _listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, "Ignored BadData on " + line.GetLineDescription()));
                }

                //move to next line
                _dataPusher.BadLines.Add(line.LineNumber);

                break;

            case BadDataHandlingStrategy.DivertRows:
                DivertErrorRow(line, null);
                break;

            case BadDataHandlingStrategy.ThrowException:
                throw new FlatFileLoadException("Bad data found on " + line.GetLineDescription());


            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        public void DivertErrorRow(FlatFileLine line, Exception ex)
        {
            if (DivertErrorsFile == null)
            {
                DivertErrorsFile = new FileInfo(Path.Combine(_fileToLoad.File.Directory.FullName, Path.GetFileNameWithoutExtension(_fileToLoad.File.Name) + "_Errors.txt"));

                //delete any old version
                if (DivertErrorsFile.Exists)
                {
                    DivertErrorsFile.Delete();
                }
            }

            if (_maximumErrorsToReport-- > 0)
            {
                _listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, "Diverting Error on " + line.GetLineDescription() + " to '" + DivertErrorsFile.FullName + "'", ex));
            }

            File.AppendAllText(DivertErrorsFile.FullName, line.RawRecord);

            //move to next line
            _dataPusher.BadLines.Add(line.LineNumber);
        }