Skip to content

Conversation

@TooTallNate
Copy link
Contributor

Seeing users reporting mysterious serialization errors. Adding the value and root properties can help debug.

Copilot AI review requested due to automatic review settings December 7, 2025 07:58
@changeset-bot
Copy link

changeset-bot bot commented Dec 7, 2025

🦋 Changeset detected

Latest commit: 758cf9a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
devalue Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances the DevalueError class to include additional debugging context by adding value and root properties to error instances. This helps users diagnose serialization failures by providing direct references to both the problematic value that failed serialization and the root object being serialized.

Key changes:

  • Extended DevalueError constructor to accept and store value and root parameters
  • Updated all error throwing locations in uneval.js and stringify.js to pass these additional parameters
  • Exported DevalueError class from the main index for external consumption

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/utils.js Extended DevalueError class to accept and store value and root properties for enhanced debugging
src/uneval.js Updated all three DevalueError throw sites to pass the problematic value and root object
src/stringify.js Updated all three DevalueError throw sites to pass the problematic value and root object
test/test.js Added comprehensive test coverage for the new value and root properties across all error types (function, non-POJO, symbolic keys)
index.js Exported DevalueError class to make it available for external error handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

thank you!

@Rich-Harris Rich-Harris merged commit a3d09d4 into sveltejs:main Dec 8, 2025
3 checks passed
@Rich-Harris Rich-Harris mentioned this pull request Dec 8, 2025
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.

2 participants