From 169f4f7c93adc999d4954692367ddff9aa4524b3 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 18 Aug 2021 13:56:45 +0100 Subject: [PATCH] Add Panic codes and Panic/Error declaration --- stdlib/errors.sol | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/stdlib/errors.sol b/stdlib/errors.sol index 7ab8e8fb8a4b..00edab6c5c37 100644 --- a/stdlib/errors.sol +++ b/stdlib/errors.sol @@ -1,5 +1,19 @@ // SPDX-License-Identifier: Apache-2.0 +uint constant PanicGeneric = 0x00; +uint constant PanicAssert = 0x01; +uint constant PanicUnderOverflow = 0x11; +uint constant PanicDivisionByZero = 0x12; +uint constant PanicEnumConversionError = 0x21; +uint constant PanicStorageEncodingError = 0x22; +uint constant PanicEmptyArrayPop = 0x31; +uint constant PanicArrayOutOfBounds = 0x32; +uint constant PanicResourceError = 0x41; +uint constant PanicInvalidInternalFunction = 0x51; + +error Panic(uint code); +error Error(string reason); + function revert() { assembly { revert(0, 0)