feat(neon): Implement TryIntoJs/TryFromJs for either::Either #1078
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 implements the extract traits for
either::Either
. I chose not to feature flag it becauseeither
is a very small crate with zero dependencies.The
Ok
implementation paths were very clear. However, there isn't an obviously correct implementation for a failedTryFromJs
.We have two errors, both
L::Error
andR::Error
. This PR does the following:Error
that prints the type name ofL
andR
saying that they failedleft
andright
keys to the error object with theirTryIntoJs
implementationAnother option would be to return only one of the errors. Unfortunately, we can't attach one error to the other because it might not be an
Object
.What's the best thing to do for this?