Skip to content

Conversation

@guibescos
Copy link
Contributor

@guibescos guibescos commented Sep 13, 2022

Replace InvalidArgument by InvalidNumberOfAccounts and InvalidAccountHeader.

@guibescos guibescos marked this pull request as ready for review September 13, 2022 23:38
Copy link
Contributor

@tompntn tompntn left a comment

Choose a reason for hiding this comment

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

Nice!

InvalidPda = 615,
#[error("InvalidAccountHeader")]
InvalidAccountHeader = 616,
#[error("InvalidNumberOfAccounts")]
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the error attribute is supposed to be a human-readable explanation of the error - for example invalid number of accounts passed. This representation can then be used in logs and user-facing error messages, without the need to map the errors to strings.

@guibescos guibescos merged commit 38223c1 into main Sep 14, 2022
@guibescos guibescos deleted the better-errors branch September 14, 2022 15:52
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.

4 participants