Error codes in assert()

The example given in the overview docs mentions 99 as an error code.

    // Ensure that the transaction sender is the recipient. If this assertion
    // fails, the transaction will fail and none of its effects (e.g.,
    // removing the earmarked coin) will be committed.  99 is an error code
    // that will be emitted in the transaction output if the assertion fails.
    assert(*(&move(t_ref).recipient) == move(sender), 99);

elsewhere in the code i see assert(<condition>, 77);

Are these error codes supposed to be custom defined by authors of the Move modules, or are they natively defined in the language somewhere? If the latter, what do 99 or 77 correspond to, and if someone could point me to where in the code they are defined that would be much appreciated.

Hi Savil,
The error codes are indeed defined by the authors of Move modules as you suggest. Error codes are a convenience for debugging/understanding why a transaction failed—they don’t have any sort of special meaning.

3 Likes