-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Error messages in all Contracts and Transactions to be more descriptive #795
Comments
This is a great initiative and very helpful for everyone! Just wanted to note that currently, repeated |
Good suggestion! I guess I missed seeing that FLIP when it was originally proposed. I'll definitely wait until that feature is implemented to do the rest of the changes, but the changes to the ledger transactions specifically will probably need to still happen sooner because a different initiative is dependent on them. |
Issue to be solved
Error messages for panics in transactions and contracts are not very helpful to end-users.
They should be updated to be more descriptive and re-usable
We should also try to gear them to be able to be understood by regular users if possible so they can know how to fix them or what to say to whatever support person they are talking to
Suggest A Solution
Update 10/17/2024: We will hold off on making any more changes until onflow/flips#289 is implemented and use that string formatting from then on
Go through all the standard contracts, transactions, and scripts in every smart contract repo to update them with good error messages.
When applicable, contracts should have utility functions that return common error messages. For example,
FungibleToken
could have a utility function that returns a message that describes when a Vault of a particular type is not borrowable in the signer's or receiver's account. This way, transactions, can use this function to create the error message instead of having to hard-code it themselves which introduces the risk of human error with a typo.Error messages could contain:
ExampleToken.Vault.deposit: ..."
.
to make it less confusing to regular users who might see it<>
to contain the type=
sign. For example:These are all up for debate
We also will likely want to include pages in the docs sites for recommendations for error messages
We will also need to reach out to important partners to get them to update theirs as well
Repos to update:
Potential Future Updates
Include Error codes, potentially per contract, that a user can look up in each project's documentation
Include errors in a struct that has additional metadata
References
https://doc.rust-lang.org/error_codes/E0015.html
The text was updated successfully, but these errors were encountered: