pub enum RevertReason<T> {
ContractError(ContractError<T>),
RawString(String),
}
Expand description
Represents the reason for a revert in a smart contract.
This enum captures two possible scenarios for a revert:
-
ContractError
: Contains detailed error information, such as a specificRevert
orPanic
error. -
RawString
: Represents a raw string message as the reason for the revert.
Variants§
ContractError(ContractError<T>)
A detailed contract error, including a specific revert or panic error.
RawString(String)
Represents a raw string message as the reason for the revert.
Implementations§
Source§impl<T: SolInterface> RevertReason<T>
impl<T: SolInterface> RevertReason<T>
Sourcepub fn decode(out: &[u8]) -> Option<Self>
pub fn decode(out: &[u8]) -> Option<Self>
Decodes and retrieves the reason for a revert from the provided output data.
This method attempts to decode the provided output data as a generic contract error or a UTF-8 string (for Vyper reverts).
If successful, it returns the decoded revert reason wrapped in an Option
.
If both attempts fail, it returns None
.
Source§impl<T: SolInterface + Display> RevertReason<T>
impl<T: SolInterface + Display> RevertReason<T>
Trait Implementations§
Source§impl<T: Clone> Clone for RevertReason<T>
impl<T: Clone> Clone for RevertReason<T>
Source§fn clone(&self) -> RevertReason<T>
fn clone(&self) -> RevertReason<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<T: Debug> Debug for RevertReason<T>
impl<T: Debug> Debug for RevertReason<T>
Source§impl<T: Display> Display for RevertReason<T>
impl<T: Display> Display for RevertReason<T>
Source§impl<T> From<ContractError<T>> for RevertReason<T>
impl<T> From<ContractError<T>> for RevertReason<T>
Converts a ContractError<T>
into a RevertReason<T>
.
Source§fn from(error: ContractError<T>) -> Self
fn from(error: ContractError<T>) -> Self
Source§impl<T> From<Revert> for RevertReason<T>
impl<T> From<Revert> for RevertReason<T>
Converts a Revert
into a RevertReason<T>
.
Source§impl<T> From<String> for RevertReason<T>
impl<T> From<String> for RevertReason<T>
Converts a String
into a RevertReason<T>
.
Source§impl<T: PartialEq> PartialEq for RevertReason<T>
impl<T: PartialEq> PartialEq for RevertReason<T>
impl<T: Eq> Eq for RevertReason<T>
impl<T> StructuralPartialEq for RevertReason<T>
Auto Trait Implementations§
impl<T> Freeze for RevertReason<T>where
T: Freeze,
impl<T> RefUnwindSafe for RevertReason<T>where
T: RefUnwindSafe,
impl<T> Send for RevertReason<T>where
T: Send,
impl<T> Sync for RevertReason<T>where
T: Sync,
impl<T> Unpin for RevertReason<T>where
T: Unpin,
impl<T> UnwindSafe for RevertReason<T>where
T: UnwindSafe,
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
)