-
Notifications
You must be signed in to change notification settings - Fork 709
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
refactor(bindings): add general bindings error context #4811
Conversation
cb4e221
to
8f95b15
Compare
#[derive(Debug, PartialEq)] | ||
#[derive(Copy, Clone, Debug, PartialEq)] |
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.
@camshaft you mentioned you're not a fan of Copy in #4764 (comment). Do you think we can get away with it here, since it's more for reading than writing, or should I still avoid it? Things work fine with clone, it's just slightly more annoying to deal with.
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.
Copy is usually fine, it just means you need to keep in mind how you end up using it (I think shared an example issue that can arise in the other 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.
This type should be ok though
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.
Looks good. I like this approach more than the previous attempt
Resolved issues:
I'm just going to keep pulling bits out of #4764 until it gets approved :)
Description of changes:
Adding a new error currently involves updating a bunch of very repetitive match statements. Switch to a more flexible solution.
Testing:
Added a little unit test. I also switched our two existing errors to use the new context, and those errors are used throughout the bindings.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.