Skip to content

feat(lang): Add error type support to declare_program! macro#4053

Closed
AvhiMaz wants to merge 1 commit intosolana-foundation:masterfrom
AvhiMaz:feat/declare-program-error-types
Closed

feat(lang): Add error type support to declare_program! macro#4053
AvhiMaz wants to merge 1 commit intosolana-foundation:masterfrom
AvhiMaz:feat/declare-program-error-types

Conversation

@AvhiMaz
Copy link
Copy Markdown

@AvhiMaz AvhiMaz commented Nov 12, 2025

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

  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>
@vercel
Copy link
Copy Markdown

vercel bot commented Nov 12, 2025

@AvhiMaz is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Collaborator

@0x4ka5h 0x4ka5h left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
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 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature request: add error types to declare_program!

3 participants