-
Notifications
You must be signed in to change notification settings - Fork 42
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(runtime): change system_program error to enum #618
Conversation
Codecov ReportAttention: Patch coverage is
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
We can merge without full test coverage, as those areas require a lot of boilerplate to hit. Will revisit later to improve.
@@ -1,5 +1,5 @@ | |||
/// [agave] https://github.com/solana-program/system/blob/6185b40460c3e7bf8badf46626c60f4e246eb422/interface/src/error.rs#L12 | |||
pub const Error = error{ | |||
pub const Error = enum(u8) { | |||
/// An account with the same address already exists. | |||
AccountAlreadyInUse, |
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.
With the switch to enum, I think the variants should now be snake_case
Native program errors should be enums, or implement a mapError method to map the error to the correct int according to Agave's analogous enum definition. If try semantics are required, using a map function with a switch may be the best option. Otherwise an enum is simpler.