Skip to content

Commit

Permalink
Add Panic codes and Panic/Error declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Aug 18, 2021
1 parent 7beb1c0 commit 169f4f7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions stdlib/errors.sol
Original file line number Diff line number Diff line change
@@ -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)
Expand Down

0 comments on commit 169f4f7

Please sign in to comment.