Skip to content

Better error message with missing sudo (no parse error)#279

Merged
ethanfrey merged 1 commit intomasterfrom
better-sudo-error-messages
Apr 21, 2021
Merged

Better error message with missing sudo (no parse error)#279
ethanfrey merged 1 commit intomasterfrom
better-sudo-error-messages

Conversation

@ethanfrey
Copy link
Copy Markdown
Contributor

Closes #278

I introduced Any rather than String. Any is like Empty (parses any struct), but it has a needed Display implementation.
When we are happy with this, and merged, we can port over the Display implementation to cosmwasm_std::Empty for the future.

@ethanfrey ethanfrey requested a review from maurolacy April 20, 2021 20:30
@ethanfrey ethanfrey merged commit 46c8d69 into master Apr 21, 2021
@ethanfrey ethanfrey deleted the better-sudo-error-messages branch April 21, 2021 08:41
/// Wraps the exported functions from a contract and provides the normalized format
/// Place T4 and E4 at the end, as we just want default placeholders for most contracts that don't have sudo
pub struct ContractWrapper<T1, T2, T3, E1, E2, E3, C = Empty, T4 = String, E4 = String>
pub struct ContractWrapper<T1, T2, T3, E1, E2, E3, C = Empty, T4 = Any, E4 = Any>
Copy link
Copy Markdown
Member

@webmaster128 webmaster128 Apr 21, 2021

Choose a reason for hiding this comment

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

Why don't you use T4 = Empty and E4 = String?

String is a great default error type. The only restrictions those types have is ToString. So requiring Display is more than necessary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm.. that might work and be a simpler solution.
Will try

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just approved your PR to that end

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.

Sudo over no new_with_sudo contract wrapper error message

3 participants