Skip to content

test: cover worker throwing primitive values#64365

Open
dobbydobap wants to merge 1 commit into
nodejs:mainfrom
dobbydobap:test-worker-error-primitive
Open

test: cover worker throwing primitive values#64365
dobbydobap wants to merge 1 commit into
nodejs:mainfrom
dobbydobap:test-worker-error-primitive

Conversation

@dobbydobap

Copy link
Copy Markdown

What this does: Adds a regression test asserting that when a worker throws a non-Error value (string, number, bigint, boolean, null, undefined), the parent's 'error' handler receives that value directly rather than a wrapped ERR_UNHANDLED_ERROR.

The behavior is already correct on main; this adds the missing coverage so #35506 can't regress.

How I tested: python tools/test.py test/parallel/test-worker-error-primitive.js → passes; also ran the file directly.

A worker that throws a non-Error value (string, number, bigint,
boolean, null, undefined) surfaces that value on the parent's
'error' handler. This was reported as a wrapped ERR_UNHANDLED_ERROR
and is now correct, but had no regression coverage.

Refs: nodejs#35506
Signed-off-by: dobbydobap <varshitha.kolupuri@gmail.com>
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Jul 8, 2026
{ code: 'throw 7n;', value: 7n },
{ code: 'throw true;', value: true },
{ code: 'throw null;', value: null },
{ code: 'throw undefined;', value: undefined },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a symbol for completeness sake

Suggested change
{ code: 'throw undefined;', value: undefined },
{ code: 'throw undefined;', value: undefined },
{ code: 'throw Symbol.for("a");', value: Symbol.for('a') },

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

Labels

needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants