Skip to content
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

feat(neon): Implement TryIntoJs/TryFromJs for either::Either #1078

Open
wants to merge 1 commit into
base: kv/try-from-error
Choose a base branch
from

Conversation

kjvalencik
Copy link
Member

This implements the extract traits for either::Either. I chose not to feature flag it because either 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 failed TryFromJs.

We have two errors, both L::Error and R::Error. This PR does the following:

  • Creates a new Error that prints the type name of L and R saying that they failed
  • Attaches left and right keys to the error object with their TryIntoJs implementation

Another 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?

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.

1 participant