feat(lang): Add error type support to declare_program! macro#4053
feat(lang): Add error type support to declare_program! macro#4053AvhiMaz wants to merge 1 commit intosolana-foundation:masterfrom
Conversation
This allows external programs declared with declare_program! to expose their error types, making it easier to check and handle errors from external programs. Error types are re-exported at the top level of the declared program module for convenient access. Closes solana-foundation#3902 Signed-off-by: AvhiMaz <avhimazumder5@outlook.com>
|
@AvhiMaz is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
acheroncrypto
left a comment
There was a problem hiding this comment.
Thanks for the PR, but declare_program! intentionally does not clutter the root namespace to make it easier to find the stuff you're looking for in the self-descriptive child modules (e.g. accounts, errors, events). It's better to keep it this way not only because it's cleaner, but also because we might support multiple error definitions in the future.
The issue this PR is trying to fix (#3902) was created before we had a release that included the new errors module (in v0.32.0).
Although not the main reason for closing the PR, the title/commit message "Add error type support to declare_program! macro" is quite misleading because the error type support was actually added in #3757, and as you mentioned in the description, this PR only adds re-exports for the error type.
This PR allows external programs declared with declare_program! to expose their error types, making it easier to check and handle errors from external programs. Error types are re-exported at the top level of the declared program module for convenient access.
Fixes #3902