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

refactor(bindings): add general bindings error context #4811

Merged
merged 3 commits into from
Oct 2, 2024

Conversation

lrstewart
Copy link
Contributor

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.

@github-actions github-actions bot added the s2n-core team label Oct 1, 2024
#[derive(Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq)]
Copy link
Contributor Author

@lrstewart lrstewart Oct 1, 2024

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.

Copy link
Contributor

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)

Copy link
Contributor

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

@lrstewart lrstewart marked this pull request as ready for review October 1, 2024 07:33
Copy link
Contributor

@camshaft camshaft left a 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

@lrstewart lrstewart enabled auto-merge (squash) October 2, 2024 00:26
@lrstewart lrstewart merged commit 50ad945 into aws:main Oct 2, 2024
37 checks passed
@lrstewart lrstewart deleted the bindings_error branch October 2, 2024 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants