You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error messages for panics in transactions and contracts are not very helpful to end-users.
They should be updated to be more descriptive.
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
Go through all the standard contracts, transactions, and scripts in every smart contract repo to update them with good error messages. Error messages could contain:
Contract name, resource name, and function name if coming from a contract
Example: ExampleToken.Vault.deposit: ..."
Description of literal error
Description of what high-level reason is causing the error
Suggestion for fixing it if applicable
If referring to a type that a regular user might understand like TopShot.Collection, use the format "TopShot Collection" or "FungibleToken Vault" instead of using . to make it less confusing to regular users who might see it
If including type values in the error message where the type is especially important or is a user-provided argument, use <> to contain the type
If including any other value type, try to phrase the error message so that the the value does not need to be contained in parentheses or an = sign. For example:
let withdrawRef = signer.storage.borrow<auth(NonFungibleToken.Withdraw) &{NonFungibleToken.Collection}>(
from: self.collectionData.storagePath
) ?? panic("The signer does not store a "
.concat(contractName)
.concat(" Collection object at the path ")
.concat(self.collectionData.storagePath.toString())
.concat("The signer must initialize their account with this collection first!"))
If you do need to use some sort of symbol to contain values, try to use parentheses. For example:
let resolverRef = getAccount(contractAddress)
.contracts.borrow<&{NonFungibleToken}>(name: contractName)
?? panic("Could not borrow NonFungibleToken reference to the contract. Make sure the provided contract name ("
.concat(contractName).concat(") and address (").concat(contractAddress.toString()).concat(") are correct!"))
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:
flow-nft
flow-ft
bridged-usdc
flow-core-contracts
nft-storefront
nft-catalog
hybrid-custody
Rewards
EVM Bridge
contract-updater
tutorials
ft and nft guides
Flow Wallet Transactions
dapper repos
FIND
Flowty
Increment
What are you currently working on that this is blocking?
Users are confused
The text was updated successfully, but these errors were encountered:
joshuahannan
changed the title
Update Error messages in all transactions to be more descriptive
Update Error messages in all Contracts and Transactions to be more descriptive
Sep 24, 2024
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.
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
Go through all the standard contracts, transactions, and scripts in every smart contract repo to update them with good error messages. 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:
What are you currently working on that this is blocking?
Users are confused
The text was updated successfully, but these errors were encountered: