Skip to content

fix(csv-parse): propagate date cast errors through streams - #552

Open
Sskift wants to merge 3 commits into
adaltas:masterfrom
Sskift:fix/cast-date-stream-errors
Open

Sskift wants to merge 3 commits into
adaltas:masterfrom
Sskift:fix/cast-date-stream-errors

Conversation

@Sskift

@Sskift Sskift commented Nov 2, 2026

Copy link
Copy Markdown

A custom cast_date function can throw directly from parser.write() while parsing a complete field. The stream's error event and callback then miss the exception. Ordinary custom cast functions already use the parser's error return path.

Catch cast_date exceptions in the same place and return them to the stream adapter. Make the Web Stream adapter throw returned parser errors so the active write rejects with the same error as the readable side. This preserves the existing Web Stream behavior for date callback exceptions and also covers ordinary cast and syntax errors. The synchronous API continues to throw the original error.

Validation:

  • Four new write-phase regressions fail before the fix; three flush/sync controls already pass. All seven pass after the fix.
  • Checks first and later records, skip_records_with_error on/off, exact error identity and one error event/callback.
  • Six Web Stream regressions check write/close rejection, readable failure and writable closure with the original error. Three write cases fail before the adapter change; all six pass afterward.
  • csv-parse suite: 573 passing, two pending, excluding the existing Windows sample-path collection failure tracked in fix: resolve sample file URLs as native paths #512.
  • TypeScript, changed-file ESLint/Prettier and git diff --check pass.

AI-assisted implementation and local verification using Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant