Skip to content

Added table of standard error codes to end of custom error codes topic. #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions source/mainnet/smart-contracts-v0/guides/custom-errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,27 @@ Return custom errors, as you would with any other error type:
_ctx: &impl HasReceiveContext<()>,
_state: &mut State,
) -> Result<A, MyError> { Err(MyError::ErrTwo) }

Standard error codes
====================

The following standard error codes exist:

=========================================== ===========================
Variant Error code
=========================================== ===========================
() i32::MIN + 1 (-2147483647)
ParseError i32::MIN + 2 (-2147483646)
LogError::Full i32::MIN + 3 (-2147483645)
LogError::Malformed i32::MIN + 4 (-2147483644)
NewContractNameError::MissingInitPrefix i32::MIN + 5 (-2147483643)
NewContractNameError::TooLong i32::MIN + 6 (-2147483642)
NewContractNameError::ContainsDot i32::MIN + 9 (-2147483639)
NewContractNameError::InvalidCharacters i32::MIN + 10 (-2147483638)
NewReceiveNameError::MissingDotSeparator i32::MIN + 7 (-2147483641)
NewReceiveNameError::TooLong i32::MIN + 8 (-2147483640)
NewReceiveNameError::InvalidCharacters i32::MIN + 11 (-2147483637)
NotPayableError i32::MIN + 12 (-2147483636)
=========================================== ===========================

The error codes are also listed in `the library documentation on docs.rs <https://docs.rs/concordium-std/2.0.0/concordium_std/index.html#signalling-errors>`_.
38 changes: 38 additions & 0 deletions source/mainnet/smart-contracts/guides/custom-errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,41 @@ Return custom errors, as you would with any other error type:

Adding :ref:`schemas<build-schema>` to your errors makes them more useful in
``concordium-client`` and ``cargo-concordium``.

Standard error codes
====================

The following standard error codes exist:

=========================================== ===========================
Variant Error code
=========================================== ===========================
() i32::MIN + 1 (-2147483647)
ParseError i32::MIN + 2 (-2147483646)
LogError::Full i32::MIN + 3 (-2147483645)
LogError::Malformed i32::MIN + 4 (-2147483644)
NewContractNameError::MissingInitPrefix i32::MIN + 5 (-2147483643)
NewContractNameError::TooLong i32::MIN + 6 (-2147483642)
NewContractNameError::ContainsDot i32::MIN + 9 (-2147483639)
NewContractNameError::InvalidCharacters i32::MIN + 10 (-2147483638)
NewReceiveNameError::MissingDotSeparator i32::MIN + 7 (-2147483641)
NewReceiveNameError::TooLong i32::MIN + 8 (-2147483640)
NewReceiveNameError::InvalidCharacters i32::MIN + 11 (-2147483637)
NotPayableError i32::MIN + 12 (-2147483636)
TransferError::AmountTooLarge i32::MIN + 13 (-2147483635)
TransferError::MissingAccount i32::MIN + 14 (-2147483634)
CallContractError::AmountTooLarge i32::MIN + 15 (-2147483633)
CallContractError::MissingAccount i32::MIN + 16 (-2147483632)
CallContractError::MissingContract i32::MIN + 17 (-2147483631)
CallContractError::MissingEntrypoint i32::MIN + 18 (-2147483630)
CallContractError::MessageFailed i32::MIN + 19 (-2147483629)
CallContractError::LogicReject i32::MIN + 20 (-2147483628)
CallContractError::Trap i32::MIN + 21 (-2147483627)
UpgradeError::MissingModule i32::MIN + 22 (-2147483626)
UpgradeError::MissingContract i32::MIN + 23 (-2147483625)
UpgradeError::UnsupportedModuleVersion i32::MIN + 24 (-2147483624)
QueryAccountBalanceError i32::MIN + 25 (-2147483623)
QueryContractBalanceError i32::MIN + 26 (-2147483622)
=========================================== ===========================

The error codes are also listed in `the library documentation on docs.rs <https://docs.rs/concordium-std/latest/concordium_std/#signalling-errors>`_.
Loading