-
Notifications
You must be signed in to change notification settings - Fork 69
Add value and root properties in DevalueError instances
#126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…context in errors
🦋 Changeset detectedLatest commit: 758cf9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this 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
DevalueErrorconstructor to accept and storevalueandrootparameters - Updated all error throwing locations in
uneval.jsandstringify.jsto pass these additional parameters - Exported
DevalueErrorclass 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.
Rich-Harris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
Seeing users reporting mysterious serialization errors. Adding the
valueandrootproperties can help debug.