Skip to content

fix(stream-transform): throw handler errors in sync API - #517

Open
20ns wants to merge 1 commit into
adaltas:masterfrom
20ns:fix/sync-transform-errors
Open

20ns wants to merge 1 commit into
adaltas:masterfrom
20ns:fix/sync-transform-errors

Conversation

@20ns

@20ns 20ns commented Oct 1, 2026 •

Copy link
Copy Markdown

When a handler throws, stream-transform/sync currently returns partial results, processes later records, and then emits an unhandled error from its internal stream. A try/catch around transform() cannot catch the original failure.

Make the sync adapter throw the original error immediately by overriding its local error path, alongside the existing push override. The regression checks error identity and that later records are skipped. The stream and callback APIs retain their existing error handling.

Validation:

  • The new regression fails against the original source with Missing expected exception and passes with the fix.
  • Full workspace tests and type checks pass on Node 20.20.2, 22.22.0, and 24.21.0: 1,078 passing, 6 existing pending tests on each version. The stream-transform package has 82 passing tests.
  • Repository lint passes with 6 existing warnings for pending tests; the changed files have no warnings or errors.
  • Package build, built CJS and browser ESM smoke checks, and git diff --check pass.

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