Errors
The FA2 standard defines a set of standard errors to make it easier to integrate FA2 contracts with wallets, dApps and other generic software and enable localization of user-visible error messages.
Each error code is a short-abbreviated string mnemonic. An FA2 contract client could use an on-chain or off-chain registry to map the error code mnemonic to a user-readable, localized message.
A particular implementation of the FA2 contract may extend the standard set of errors with custom mnemonics for additional constraints.
The FA2 library raises these standard exceptions from the FA2 standard:
Error mnemonic | Description |
---|---|
"FA2_TOKEN_UNDEFINED" | One of the specified token IDs is not defined within the FA2 contract |
"FA2_INSUFFICIENT_BALANCE" | A token owner does not have sufficient balance to transfer the specified tokens |
"FA2_TX_DENIED" | A transfer failed because the transfer policy does not permit transfers |
"FA2_NOT_OWNER" | A transfer failed because the request did not come from the token owner or the transfer policy forbids operators from transferring tokens |
"FA2_NOT_OPERATOR" | A transfer failed because the request did not come from the owner or operator of a token |
"FA2_OPERATORS_UNSUPPORTED" | The update_operators entrypoint was invoked and the transfer policy is no-transfer or owner-transfer |
The FA2 library also raises this custom error:
Error mnemonic | Description |
---|---|
"FA2_NOT_ADMIN" | The sender of the transaction is not the administrator |
According to the standard, if more than one error condition is met, the entrypoint may raise any applicable error.