-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
@CanardMandarin is attempting to deploy a commit to the coral-xyz Team on Vercel. A member of the Team first needs to authorize it. |
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.
Thanks, I think this would be great to have.
Before we merge, could you add a test case for this here?
Sure! I have added a test case. |
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.
Please also add the new error variant in TS package:
anchor/ts/packages/anchor/src/error.ts
Line 308 in 14309ea
export const LangErrorCode = { anchor/ts/packages/anchor/src/error.ts
Line 402 in 14309ea
export const LangErrorMessage = new Map([
My bad, I should have thought about it! |
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.
Feel free to modify the changelog entry if the description is not clear. |
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.
Thanks!
I noticed it was a bit painful to cast integers with
try_into
andtry_from
because you have to eitherunwrap()
ormap_err(||)
.What about implementing
TryFromIntError
forError
so we can use the?
operator?