pub enum ContractError<M>where
M: Middleware,{
DecodingError(Error),
AbiError(AbiError),
DetokenizationError(InvalidOutputType),
MiddlewareError {
e: <M as Middleware>::Error,
},
ProviderError {
e: ProviderError,
},
Revert(Bytes),
ConstructorError,
ContractNotDeployed,
}Expand description
An Error which is thrown when interacting with a smart contract
Variants§
DecodingError(Error)
Thrown when the ABI decoding fails
AbiError(AbiError)
Thrown when the internal BaseContract errors
DetokenizationError(InvalidOutputType)
Thrown when detokenizing an argument
MiddlewareError
Thrown when a middleware call fails
Fields
e: <M as Middleware>::ErrorThe underlying error
ProviderError
Thrown when a provider call fails
Fields
e: ProviderErrorThe underlying error
Revert(Bytes)
Contract reverted
ConstructorError
Thrown during deployment if a constructor argument was passed in the deploy
call but a constructor was not present in the ABI
ContractNotDeployed
Thrown if a contract address is not found in the deployment transaction’s receipt
Implementations§
Source§impl<M> ContractError<M>where
M: Middleware,
impl<M> ContractError<M>where
M: Middleware,
Sourcepub fn as_revert(&self) -> Option<&Bytes>
pub fn as_revert(&self) -> Option<&Bytes>
If this ContractError is a revert, this method will retrieve a
reference to the underlying revert data. This ABI-encoded data could be
a String, or a custom Solidity error type.
§Returns
None if the error is not a revert
Some(data) with the revert data, if the error is a revert
§Note
To skip this step, consider using ContractError::decode_revert
Sourcepub fn decode_revert<Err>(&self) -> Option<Err>where
Err: EthError,
pub fn decode_revert<Err>(&self) -> Option<Err>where
Err: EthError,
Decode revert data into an EthError type. Returns None if
decoding fails, or if this is not a revert
Sourcepub fn decode_contract_revert<Err>(&self) -> Option<Err>where
Err: ContractRevert,
pub fn decode_contract_revert<Err>(&self) -> Option<Err>where
Err: ContractRevert,
Decode revert data into a ContractRevert type. Returns None if
decoding fails, or if this is not a revert
This is intended to be used with error enum outputs from abigen!
contracts
Sourcepub fn from_middleware_error(e: <M as Middleware>::Error) -> ContractError<M>
pub fn from_middleware_error(e: <M as Middleware>::Error) -> ContractError<M>
Convert a MiddlewareError to a ContractError
Sourcepub fn as_middleware_error(&self) -> Option<&<M as Middleware>::Error>
pub fn as_middleware_error(&self) -> Option<&<M as Middleware>::Error>
Convert a ContractError to a MiddlewareError if possible.
Sourcepub fn is_middleware_error(&self) -> bool
pub fn is_middleware_error(&self) -> bool
True if the error is a middleware error
Sourcepub fn as_provider_error(&self) -> Option<&ProviderError>
pub fn as_provider_error(&self) -> Option<&ProviderError>
Convert a ContractError to a ProviderError if possible.
Sourcepub fn is_provider_error(&self) -> bool
pub fn is_provider_error(&self) -> bool
True if the error is a provider error
Trait Implementations§
Source§impl<M> Debug for ContractError<M>
impl<M> Debug for ContractError<M>
Source§impl<M> Display for ContractError<M>where
M: Middleware,
impl<M> Display for ContractError<M>where
M: Middleware,
Source§impl<M> Error for ContractError<M>
impl<M> Error for ContractError<M>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl<M> From<AbiError> for ContractError<M>where
M: Middleware,
impl<M> From<AbiError> for ContractError<M>where
M: Middleware,
Source§fn from(source: AbiError) -> ContractError<M>
fn from(source: AbiError) -> ContractError<M>
Source§impl<M> From<ContractError<M>> for MulticallError<M>where
M: Middleware,
impl<M> From<ContractError<M>> for MulticallError<M>where
M: Middleware,
Source§fn from(source: ContractError<M>) -> MulticallError<M>
fn from(source: ContractError<M>) -> MulticallError<M>
Source§impl<M> From<Error> for ContractError<M>where
M: Middleware,
impl<M> From<Error> for ContractError<M>where
M: Middleware,
Source§fn from(source: Error) -> ContractError<M>
fn from(source: Error) -> ContractError<M>
Source§impl<M> From<InvalidOutputType> for ContractError<M>where
M: Middleware,
impl<M> From<InvalidOutputType> for ContractError<M>where
M: Middleware,
Source§fn from(source: InvalidOutputType) -> ContractError<M>
fn from(source: InvalidOutputType) -> ContractError<M>
Source§impl<M> From<ProviderError> for ContractError<M>where
M: Middleware,
impl<M> From<ProviderError> for ContractError<M>where
M: Middleware,
Source§fn from(e: ProviderError) -> ContractError<M>
fn from(e: ProviderError) -> ContractError<M>
Auto Trait Implementations§
impl<M> !Freeze for ContractError<M>
impl<M> !RefUnwindSafe for ContractError<M>
impl<M> Send for ContractError<M>
impl<M> Sync for ContractError<M>
impl<M> Unpin for ContractError<M>
impl<M> !UnwindSafe for ContractError<M>
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> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.