Add value and root properties in DevalueError instances#126
Add value and root properties in DevalueError instances#126Rich-Harris merged 4 commits intosveltejs:mainfrom
value and root properties in DevalueError instances#126Conversation
…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.
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.
Seeing users reporting mysterious serialization errors. Adding the
valueandrootproperties can help debug.