Skip to content

anchor: add custom error for raw constraint#905

Merged
armaniferrante merged 3 commits into
otter-sec:masterfrom
fanatid:constraint-custom-error
Oct 21, 2021
Merged

anchor: add custom error for raw constraint#905
armaniferrante merged 3 commits into
otter-sec:masterfrom
fanatid:constraint-custom-error

Conversation

@fanatid

@fanatid fanatid commented Oct 20, 2021

Copy link
Copy Markdown
Contributor

Issue #509

  • Should we add custom error support for all constraints?
  • Is there a way to allow custom errors for Signer / Program?
  • We can't use ? because it's parsed with expr, are we ok with @?

@armaniferrante

Copy link
Copy Markdown
Contributor

LGTM.

  • Probably, though happy to start with constraint = only for now.
  • No, but we can solve that by mapping the error and logging the context (e.g. the variable name and key)
  • @ sounds good to me

@fanatid

fanatid commented Oct 20, 2021

Copy link
Copy Markdown
Contributor Author

Thanks. I think I need to add some documentation and lines to CHANGELOG.md before merging.

@fanatid

fanatid commented Oct 21, 2021

Copy link
Copy Markdown
Contributor Author

Updated. I also moved errors-related code to functions, so adding custom errors for other constraints should be easy.

@armaniferrante armaniferrante merged commit d41fb4f into otter-sec:master Oct 21, 2021
@fanatid fanatid deleted the constraint-custom-error branch October 22, 2021 05:45
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
@jamie-osec jamie-osec added this to the Pre-1.0 milestone Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants