use ethers::types::H256; use thiserror::Error; use crate::types::BlockTag; #[derive(Debug, Error)] #[error("block not available: {block}")] pub struct BlockNotFoundError { block: BlockTag, } impl BlockNotFoundError { pub fn new(block: BlockTag) -> Self { Self { block } } } #[derive(Debug, Error)] #[error("slot not found: {slot:?}")] pub struct SlotNotFoundError { slot: H256, } impl SlotNotFoundError { pub fn new(slot: H256) -> Self { Self { slot } } } #[derive(Debug, Error)] #[error("rpc error on method: {method}, message: {error}")] pub struct RpcError { method: String, error: E, } impl RpcError { pub fn new(method: &str, err: E) -> Self { Self { method: method.to_string(), error: err, } } }