pub enum SemioscanError {
BlockWindow(BlockWindowError),
Gas(GasCalculationError),
Price(PriceCalculationError),
Events(EventProcessingError),
Retrieval(RetrievalError),
}Expand description
Unified error type for all semioscan operations.
This enum wraps all module-specific error types, providing a convenient way to handle errors when you don’t need to distinguish between different error sources.
All module-specific error types automatically convert to SemioscanError via
From implementations, so you can use ? to propagate errors naturally.
§Examples
ⓘ
use semioscan::{SemioscanError, BlockWindowCalculator, GasCostCalculator};
use alloy_chains::NamedChain;
use chrono::NaiveDate;
async fn process_data() -> Result<(), SemioscanError> {
let block_calc = BlockWindowCalculator::with_disk_cache(provider, "cache.json")?;
let gas_calc = GasCostCalculator::new(provider);
// Both error types automatically convert to SemioscanError
let date = NaiveDate::from_ymd_opt(2024, 1, 15).unwrap();
let window = block_calc.get_daily_window(NamedChain::Arbitrum, date).await?;
let gas_cost = gas_calc.calculate_gas_cost_for_transfers_between_blocks(
NamedChain::Arbitrum, from_address, to_address, token_address, start_block, end_block
).await?;
Ok(())
}Variants§
BlockWindow(BlockWindowError)
Error from block window calculations.
Gas(GasCalculationError)
Error from gas cost calculations.
Price(PriceCalculationError)
Error from price calculations.
Events(EventProcessingError)
Error from event processing operations.
Retrieval(RetrievalError)
Error from combined data retrieval operations.
Trait Implementations§
Source§impl Debug for SemioscanError
impl Debug for SemioscanError
Source§impl Display for SemioscanError
impl Display for SemioscanError
Source§impl Error for SemioscanError
impl Error for SemioscanError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<BlockWindowError> for SemioscanError
impl From<BlockWindowError> for SemioscanError
Source§fn from(source: BlockWindowError) -> Self
fn from(source: BlockWindowError) -> Self
Converts to this type from the input type.
Source§impl From<EventProcessingError> for SemioscanError
impl From<EventProcessingError> for SemioscanError
Source§fn from(source: EventProcessingError) -> Self
fn from(source: EventProcessingError) -> Self
Converts to this type from the input type.
Source§impl From<GasCalculationError> for SemioscanError
impl From<GasCalculationError> for SemioscanError
Source§fn from(source: GasCalculationError) -> Self
fn from(source: GasCalculationError) -> Self
Converts to this type from the input type.
Source§impl From<PriceCalculationError> for SemioscanError
impl From<PriceCalculationError> for SemioscanError
Source§fn from(source: PriceCalculationError) -> Self
fn from(source: PriceCalculationError) -> Self
Converts to this type from the input type.
Source§impl From<RetrievalError> for SemioscanError
impl From<RetrievalError> for SemioscanError
Source§fn from(source: RetrievalError) -> Self
fn from(source: RetrievalError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SemioscanError
impl !RefUnwindSafe for SemioscanError
impl Send for SemioscanError
impl Sync for SemioscanError
impl Unpin for SemioscanError
impl !UnwindSafe for SemioscanError
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
Mutably borrows from an owned value. Read more
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.