feat(clone): add structuredClone support for Error objects and relate… - #5280
Open
akshatnathani wants to merge 2 commits into
Open
feat(clone): add structuredClone support for Error objects and relate…#5280akshatnathani wants to merge 2 commits into
akshatnathani wants to merge 2 commits into
Conversation
Monti-27
reviewed
Mar 29, 2026
Monti-27
reviewed
Mar 29, 2026
akshatnathani
force-pushed
the
fix/structured-clone-error-support
branch
from
March 29, 2026 23:30
0f3a392 to
98a2ce6
Compare
jedel1043
requested changes
Sep 1, 2026
jedel1043
left a comment
Member
There was a problem hiding this comment.
Looks good! I just have a couple of suggestions to improve the code.
Comment on lines
+192
to
+194
| let native = JsError::from_opaque(JsValue::from(original.clone())) | ||
| .try_native(context) | ||
| .map_err(|_| unsupported_type())?; |
Member
There was a problem hiding this comment.
This should be infallible, since we know original is already an Error type.
What we should do here is to add a conversion from JsObject<Error> to JsNativeError directly, and pass JsObject<Error> as our original object.
Comment on lines
+18
to
+24
| type ErrorStoreFields<'a> = ( | ||
| &'a ErrorKind, | ||
| &'a StringStore, | ||
| &'a StringStore, | ||
| &'a StringStore, | ||
| &'a StringStore, | ||
| ); |
Member
There was a problem hiding this comment.
This looks kinda unmaintainable; you cannot easily distinguish which field is the name, the message, the stack or the cause at first glance. A proper struct would be better to make it harder to pass the incorrect field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request fixes/closes #5279.
It changes the following: