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

Implement TryFromIntError conversion for AnchorError #2950

Merged
merged 8 commits into from
May 15, 2024

Conversation

CanardMandarin
Copy link
Contributor

I noticed it was a bit painful to cast integers with try_into and try_from because you have to either unwrap() or map_err(||).

What about implementing TryFromIntError for Error so we can use the ? operator?

Copy link

vercel bot commented May 8, 2024

@CanardMandarin is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I think this would be great to have.

Before we merge, could you add a test case for this here?

@CanardMandarin
Copy link
Contributor Author

Sure! I have added a test case.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add the new error variant in TS package:

@CanardMandarin
Copy link
Contributor Author

My bad, I should have thought about it!

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but CI has a formatting error now. Please run yarn lint:fix.

Also, it might be good to include this feature in the CHANGELOG, otherwise it would be hard to discover.

@CanardMandarin
Copy link
Contributor Author

Feel free to modify the changelog entry if the description is not clear.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@acheroncrypto acheroncrypto merged commit b7dff46 into coral-xyz:master May 15, 2024
48 of 49 checks passed
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.

2 participants