#[non_exhaustive]#[repr(u32)]pub enum PanicKind {
Generic = 0,
Assert = 1,
UnderOverflow = 17,
DivisionByZero = 18,
EnumConversionError = 33,
StorageEncodingError = 34,
EmptyArrayPop = 49,
ArrayOutOfBounds = 50,
ResourceError = 65,
InvalidInternalFunction = 81,
}
Expand description
Represents a Solidity panic. Same as the Solidity definition.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Generic = 0
Generic / unspecified error.
Generic compiler inserted panics.
Assert = 1
Used by the assert()
builtin.
Thrown when you call assert
with an argument that evaluates to
false
.
UnderOverflow = 17
Arithmetic underflow or overflow.
Thrown when an arithmetic operation results in underflow or overflow
outside of an unchecked { ... }
block.
DivisionByZero = 18
Division or modulo by zero.
Thrown when you divide or modulo by zero (e.g. 5 / 0
or 23 % 0
).
EnumConversionError = 33
Enum conversion error.
Thrown when you convert a value that is too big or negative into an enum type.
StorageEncodingError = 34
Invalid encoding in storage.
Thrown when you access a storage byte array that is incorrectly encoded.
EmptyArrayPop = 49
Empty array pop.
Thrown when you call .pop()
on an empty array.
ArrayOutOfBounds = 50
Array out of bounds access.
Thrown when you access an array, bytesN
or an array slice at an
out-of-bounds or negative index (i.e. x[i]
where i >= x.length
or
i < 0
).
ResourceError = 65
Resource error (too large allocation or too large array).
Thrown when you allocate too much memory or create an array that is too large.
InvalidInternalFunction = 81
Calling invalid internal function.
Thrown when you call a zero-initialized variable of internal function type.
Implementations§
Trait Implementations§
Source§impl Ord for PanicKind
impl Ord for PanicKind
Source§impl PartialOrd for PanicKind
impl PartialOrd for PanicKind
impl Copy for PanicKind
impl Eq for PanicKind
impl StructuralPartialEq for PanicKind
Auto Trait Implementations§
impl Freeze for PanicKind
impl RefUnwindSafe for PanicKind
impl Send for PanicKind
impl Sync for PanicKind
impl Unpin for PanicKind
impl UnwindSafe for PanicKind
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)