From 4fcd51d33dbf85db89bf9edb5306be235adb6617 Mon Sep 17 00:00:00 2001 From: dg-concordium Date: Mon, 13 Dec 2021 11:41:05 +0100 Subject: [PATCH 1/3] Added table of standard error codes to end of custom error codes topic. --- .../smart-contracts/guides/custom-errors.rst | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source/shared/smart-contracts/guides/custom-errors.rst b/source/shared/smart-contracts/guides/custom-errors.rst index 5c65b56d06..fc57f085b6 100644 --- a/source/shared/smart-contracts/guides/custom-errors.rst +++ b/source/shared/smart-contracts/guides/custom-errors.rst @@ -55,3 +55,25 @@ Return custom errors, as you would with any other error type: _ctx: &impl HasReceiveContext<()>, _state: &mut State, ) -> Result { 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) +=========================================== =========================== From 2ee8102f6d45d91cb1be747b29f5ae4da3afeef3 Mon Sep 17 00:00:00 2001 From: Kasper Dissing Bargsteen Date: Thu, 25 Apr 2024 13:54:07 +0200 Subject: [PATCH 2/3] Update error codes --- .../smart-contracts/guides/custom-errors.rst | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/source/shared/smart-contracts/guides/custom-errors.rst b/source/shared/smart-contracts/guides/custom-errors.rst index fc57f085b6..12cf7f02f5 100644 --- a/source/shared/smart-contracts/guides/custom-errors.rst +++ b/source/shared/smart-contracts/guides/custom-errors.rst @@ -64,16 +64,32 @@ The following standard error codes exist: =========================================== =========================== Variant Error code =========================================== =========================== -() i32::MIN + 1 (-2147483647) +() 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) +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) +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 `_. From ffbaad2c1d99f54a8802996764ed0fea805556a0 Mon Sep 17 00:00:00 2001 From: Kasper Dissing Bargsteen Date: Thu, 25 Apr 2024 14:10:32 +0200 Subject: [PATCH 3/3] Use correct error codes for V0 and V1 contracts --- .../guides/custom-errors.rst | 34 +++++------------ .../smart-contracts/guides/custom-errors.rst | 38 +++++++++++++++++++ 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/source/mainnet/smart-contracts-v0/guides/custom-errors.rst b/source/mainnet/smart-contracts-v0/guides/custom-errors.rst index e0d4257c81..401aa76976 100644 --- a/source/mainnet/smart-contracts-v0/guides/custom-errors.rst +++ b/source/mainnet/smart-contracts-v0/guides/custom-errors.rst @@ -64,32 +64,18 @@ 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) +() 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::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) +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 `_. +The error codes are also listed in `the library documentation on docs.rs `_. diff --git a/source/mainnet/smart-contracts/guides/custom-errors.rst b/source/mainnet/smart-contracts/guides/custom-errors.rst index 2630e81d61..6daa27a184 100644 --- a/source/mainnet/smart-contracts/guides/custom-errors.rst +++ b/source/mainnet/smart-contracts/guides/custom-errors.rst @@ -63,3 +63,41 @@ Return custom errors, as you would with any other error type: Adding :ref:`schemas` 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 `_.