Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csv/parse-stream: syntax error handling #6349

Open
mfulton26 opened this issue Jan 17, 2025 · 0 comments
Open

csv/parse-stream: syntax error handling #6349

mfulton26 opened this issue Jan 17, 2025 · 0 comments
Labels
enhancement New feature or request suggestion a suggestion yet to be agreed

Comments

@mfulton26
Copy link
Contributor

Is your feature request related to a problem? Please describe.

I want to watch a CSV file and recompute some statistics each time it changes. Sometimes the last record is incomplete:

Error: Syntax error on line 156: The record has 2 fields, but the header has 4 fields

Describe the solution you'd like

A way to handle syntax errors and continue parsing the stream rather than throwing and halting stream parsing.

e.g. onSyntaxError() option to the CsvParseStream constructor. The function can return a completed record or return something like undefined to skip the record.

Describe alternatives you've considered

Building my own stream transforming to detect an incomplete last line and not pipe it through to the CsvParseStream instance.

@kt3k kt3k added suggestion a suggestion yet to be agreed enhancement New feature or request labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request suggestion a suggestion yet to be agreed
Projects
None yet
Development

No branches or pull requests

2 participants