WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

CsvReader.HandleParseError should not throw an exception when the DefaultParseErrorAction is RaiseEvent #77

@lancasteradam

Description

@lancasteradam

Looking into dataplat/dbatools#6899 it seems that CsvReader.HandleParseError is not allowing the parsing to continue when the DefaultParseErrorAction is ParseErrorAction.RaiseEvent. Instead, an exception is thrown when the caller had intended to only raise events and continue processing the csv file.

The relevant code is at CsvReader line 1788.

A suggested change to line 1805 would be to have the following:

SkipToNextRecord();
break;

This would be similar to what is done in HandleExtraFieldsInCurrentRecord.

The switch statement from line 1806 to line 1824 should be removed.

The reason for removing that code is that the switch statement is resulting in a guaranteed exception being thrown from line 1809 since the default is being set to ThrowException on line 1803.

I would like to submit a PR for this, but I'm currently blocked by #74

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions