Contracts can use uint64_t
error codes as an alternative (and shorter) means of signaling error conditions, as opposed to string error messages. However, EOSIO and EOSIO.CDT reserve certain ranges of the uint64_t
value space for their own purposes. Contract developers must be aware of the following ranges and restrictions:
- :
Available for contract developers to assign error codes specific to their contracts. - :
Reserved for the EOSIO.CDT compiler to allocate as appropriate. Although the WASM code generated by the EOSIO.CDT compiler may use error code values that were automatically generated from within this range, the error codes in this range are meant to have meaning specific to the particular compiled contract (the meaning would typically be conveyed through the mapping between the error code value and strings in the associated generated ABI file). - :
Reserved for the EOSIO.CDT compiler to allocate as appropriate. The error codes in this range are not specific to any contract but rather are used to convey general runtime error conditions associated with the generated code by EOSIO.CDT. - :
Reserved for EOSIO to represent system-level error conditions. EOSIO will actually enforce this by restricting the ability foreosio_assert_code
to be used to fail with error code values used within this range.
Therefore, contract developers should only reserve error codes from the first range above to use in their contracts.