# Execution Error Codes¶

This section covers smart contract execution error codes.

As mentioned in Writing Rust Contracts, smart contracts can exit with an error code defined by an ApiError. Descriptions of each variant are found here and include the following sub-types:

An ApiError of one of these sub-types maps to an exit code with an offset defined by the sub-type. For example, an ApiError::User(2) maps to an exit code of 65538 (i.e. 65536 + 2). You can find a mapping from contract exit codes to ApiError variants here.