Skip to content

worker: support more cases when (de)serializing errors - #47925

Merged
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
MoLow:serialize-more-error-types
May 12, 2023
Merged

worker: support more cases when (de)serializing errors#47925
nodejs-github-bot merged 6 commits into
nodejs:mainfrom
MoLow:serialize-more-error-types

Conversation

@MoLow

@MoLowMoLow commented May 8, 2023

Copy link
Copy Markdown
Member

extracted from #47867:
the motivation of this change is for the test runner (which runs across multiple processes) to communicate with the main process via v8 serialization instead of TAP - so we want to better serialize a wider range of (edge?) cases

@nodejs-github-botnodejs-github-bot added the needs-ci PRs that need a full CI run. label May 8, 2023
@MoLow
MoLowforce-pushed the serialize-more-error-types branch from 1ce8d41 to 868e0fbCompareMay 8, 2023 18:38
@MoLow

MoLow commented May 8, 2023

Copy link
Copy Markdown
MemberAuthor

CC @nodejs/workers @nodejs/test_runner

- error.cause is potentially an error, so is now handled recursively
- best effort to serialize thrown symbols
- handle thrown object with custom inspect
@MoLow
MoLowforce-pushed the serialize-more-error-types branch from 868e0fb to 640f32bCompareMay 8, 2023 18:50
Comment threadlib/internal/error_serdes.js Outdated
Comment threadtest/parallel/test-error-serdes.js
@MoLow
MoLow requested review from aduh95 and jasnellMay 10, 2023 18:44

@aduh95aduh95 left a comment

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.

Can you add tests with Object.defineProperty(new Error, "cause", { get(){})? When the error cause is defined as a getter on the instance rather than the prototype?

Comment threadtest/parallel/test-error-serdes.js Outdated
aduh95

This comment was marked as duplicate.

@MoLow
MoLow requested review from aduh95 and cjihrigMay 11, 2023 06:25
Comment threadlib/internal/error_serdes.js Outdated
Comment threadlib/internal/error_serdes.js
Comment threadlib/internal/error_serdes.js
Comment threadlib/internal/error_serdes.js Outdated
Comment threadtest/parallel/test-error-serdes.js Outdated
@MoLow
MoLow requested a review from benjamingrMay 12, 2023 06:01
@MoLowMoLow added request-ci Add this label to start a Jenkins CI on a PR. author ready PRs that have at least one approval, no pending requests for changes, and a CI started. labels May 12, 2023
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 12, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@MoLowMoLow added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 12, 2023
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 12, 2023
@nodejs-github-bot
nodejs-github-bot merged commit 7984af6 into nodejs:mainMay 12, 2023
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 7984af6

targos pushed a commit that referenced this pull request May 14, 2023
- error.cause is potentially an error, so is now handled recursively
- best effort to serialize thrown symbols
- handle thrown object with custom inspect
PR-URL: #47925
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request May 15, 2023
- error.cause is potentially an error, so is now handled recursively
- best effort to serialize thrown symbols
- handle thrown object with custom inspect
PR-URL: #47925
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@targostargos mentioned this pull request May 15, 2023
danielleadams pushed a commit that referenced this pull request Jul 6, 2023
- error.cause is potentially an error, so is now handled recursively
- best effort to serialize thrown symbols
- handle thrown object with custom inspect
PR-URL: #47925
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
MoLow added a commit to MoLow/node that referenced this pull request Jul 6, 2023
- error.cause is potentially an error, so is now handled recursively
- best effort to serialize thrown symbols
- handle thrown object with custom inspect
PR-URL: nodejs#47925
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
@MoLow
MoLow deleted the serialize-more-error-types branch May 24, 2024 09:01
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.needs-ciPRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@MoLow@nodejs-github-bot@ljharb@jasnell@benjamingr@aduh95