Skip to content

v8: preserve DOMException in v8.serialize() - #67697

Draft
jazelly wants to merge 1 commit into
nodejs:mainfrom
jazelly:fix-53225
Draft

jazelly wants to merge 1 commit into
nodejs:mainfrom
jazelly:fix-53225

Conversation

@jazelly

@jazelly jazelly commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Fixes: #53225

v8.serialize() turns a DOMException into a plain Error with an empty message. structuredClone() already handles it.

v8.deserialize(v8.serialize(AbortSignal.abort().reason));
// before: Error {}  after: DOMException [AbortError]: This operation was aborted

SerializerContext now implements IsHostObject(), so DefaultSerializer writes cloneable DOMExceptions using the existing clone hooks (same data as structuredClone()). Plain v8.Serializer is unchanged.

child_process with serialization: 'advanced' uses node_ipc_serdes.cc and is not covered here.

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v8 module Issues and PRs related to the node:v8 module. labels Nov 22, 2026
`v8.serialize()` used V8's built-in error serialization for
`DOMException`, which lost its name and message. Let
`DefaultSerializer` handle it as a host object using the existing
clone hooks, like `structuredClone()` does.

Fixes: nodejs#53225
Assisted-by: Claude Opus 5.5
Signed-off-by: jazelly <xzha4350@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. v8 module Issues and PRs related to the node:v8 module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOMExceptions do not work with v8.serialize()

2 participants