Enum alloy_sol_types::PanicKind
source · #[repr(u32)]#[non_exhaustive]pub enum PanicKind {
Generic,
Assert,
UnderOverflow,
DivisionByZero,
EnumConversionError,
StorageEncodingError,
EmptyArrayPop,
ArrayOutOfBounds,
ResourceError,
InvalidInternalFunction,
}
Expand description
Represents a Solidity panic. Same as the Solidity definition.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Generic
Generic / unspecified error.
Generic compiler inserted panics.
Assert
Used by the assert()
builtin.
Thrown when you call assert
with an argument that evaluates to
false
.
UnderOverflow
Arithmetic underflow or overflow.
Thrown when an arithmetic operation results in underflow or overflow
outside of an unchecked { ... }
block.
DivisionByZero
Division or modulo by zero.
Thrown when you divide or modulo by zero (e.g. 5 / 0
or 23 % 0
).
EnumConversionError
Enum conversion error.
Thrown when you convert a value that is too big or negative into an enum type.
StorageEncodingError
Invalid encoding in storage.
Thrown when you access a storage byte array that is incorrectly encoded.
EmptyArrayPop
Empty array pop.
Thrown when you call .pop()
on an empty array.
ArrayOutOfBounds
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
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
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 PartialEq<PanicKind> for PanicKind
impl PartialEq<PanicKind> for PanicKind
source§impl PartialOrd<PanicKind> for PanicKind
impl PartialOrd<PanicKind> for PanicKind
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more