mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
use core::error::Error (#11317)
This commit is contained in:
@ -194,8 +194,8 @@ impl std::fmt::Debug for InsertBlockErrorData {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for InsertBlockErrorData {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for InsertBlockErrorData {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
Some(&self.kind)
|
||||
}
|
||||
}
|
||||
@ -240,8 +240,8 @@ impl std::fmt::Debug for InsertBlockErrorDataTwo {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for InsertBlockErrorDataTwo {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for InsertBlockErrorDataTwo {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
Some(&self.kind)
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,7 @@ pub enum InsertBlockErrorKindTwo {
|
||||
Provider(#[from] ProviderError),
|
||||
/// Other errors.
|
||||
#[error(transparent)]
|
||||
Other(#[from] Box<dyn std::error::Error + Send + Sync + 'static>),
|
||||
Other(#[from] Box<dyn core::error::Error + Send + Sync + 'static>),
|
||||
}
|
||||
|
||||
impl InsertBlockErrorKindTwo {
|
||||
@ -425,7 +425,7 @@ pub enum InsertBlockErrorKind {
|
||||
Provider(#[from] ProviderError),
|
||||
/// An internal error occurred, like interacting with the database.
|
||||
#[error(transparent)]
|
||||
Internal(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
/// Canonical error.
|
||||
#[error(transparent)]
|
||||
Canonical(#[from] CanonicalError),
|
||||
|
||||
@ -57,12 +57,12 @@ pub enum BeaconForkChoiceUpdateError {
|
||||
EngineUnavailable,
|
||||
/// An internal error occurred, not necessarily related to the update.
|
||||
#[error(transparent)]
|
||||
Internal(Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl BeaconForkChoiceUpdateError {
|
||||
/// Create a new internal error.
|
||||
pub fn internal<E: std::error::Error + Send + Sync + 'static>(e: E) -> Self {
|
||||
pub fn internal<E: core::error::Error + Send + Sync + 'static>(e: E) -> Self {
|
||||
Self::Internal(Box::new(e))
|
||||
}
|
||||
}
|
||||
@ -89,12 +89,12 @@ pub enum BeaconOnNewPayloadError {
|
||||
EngineUnavailable,
|
||||
/// An internal error occurred, not necessarily related to the payload.
|
||||
#[error(transparent)]
|
||||
Internal(Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl BeaconOnNewPayloadError {
|
||||
/// Create a new internal error.
|
||||
pub fn internal<E: std::error::Error + Send + Sync + 'static>(e: E) -> Self {
|
||||
pub fn internal<E: core::error::Error + Send + Sync + 'static>(e: E) -> Self {
|
||||
Self::Internal(Box::new(e))
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ pub enum EngineHookError {
|
||||
Common(#[from] RethError),
|
||||
/// An internal error occurred.
|
||||
#[error(transparent)]
|
||||
Internal(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
/// Level of database access the hook needs for execution.
|
||||
|
||||
@ -37,14 +37,14 @@ pub enum RethError {
|
||||
|
||||
/// Any other error.
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl RethError {
|
||||
/// Create a new `RethError` from a given error.
|
||||
pub fn other<E>(error: E) -> Self
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
E: core::error::Error + Send + Sync + 'static,
|
||||
{
|
||||
Self::Other(Box::new(error))
|
||||
}
|
||||
|
||||
@ -125,12 +125,11 @@ impl From<StateRootError> for BlockValidationError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for BlockValidationError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for BlockValidationError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::EVM { error, .. } => std::error::Error::source(error),
|
||||
Self::StateRoot(source) => std::error::Error::source(source),
|
||||
Self::EVM { error, .. } => core::error::Error::source(error),
|
||||
Self::StateRoot(source) => core::error::Error::source(source),
|
||||
_ => Option::None,
|
||||
}
|
||||
}
|
||||
@ -153,7 +152,7 @@ impl BlockExecutionError {
|
||||
#[cfg(feature = "std")]
|
||||
pub fn other<E>(error: E) -> Self
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
E: core::error::Error + Send + Sync + 'static,
|
||||
{
|
||||
Self::Internal(InternalBlockExecutionError::other(error))
|
||||
}
|
||||
@ -185,13 +184,12 @@ impl From<ProviderError> for BlockExecutionError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for BlockExecutionError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for BlockExecutionError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Validation(source) => std::error::Error::source(source),
|
||||
Self::Consensus(source) => std::error::Error::source(source),
|
||||
Self::Internal(source) => std::error::Error::source(source),
|
||||
Self::Validation(source) => core::error::Error::source(source),
|
||||
Self::Consensus(source) => core::error::Error::source(source),
|
||||
Self::Internal(source) => core::error::Error::source(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -216,8 +214,7 @@ pub enum InternalBlockExecutionError {
|
||||
#[from]
|
||||
LatestBlock(ProviderError),
|
||||
/// Arbitrary Block Executor Errors
|
||||
#[cfg(feature = "std")]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl InternalBlockExecutionError {
|
||||
@ -225,7 +222,7 @@ impl InternalBlockExecutionError {
|
||||
#[cfg(feature = "std")]
|
||||
pub fn other<E>(error: E) -> Self
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
E: core::error::Error + Send + Sync + 'static,
|
||||
{
|
||||
Self::Other(Box::new(error))
|
||||
}
|
||||
@ -237,12 +234,11 @@ impl InternalBlockExecutionError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for InternalBlockExecutionError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for InternalBlockExecutionError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Pruning(source) => std::error::Error::source(source),
|
||||
Self::LatestBlock(source) => std::error::Error::source(source),
|
||||
Self::Pruning(source) => core::error::Error::source(source),
|
||||
Self::LatestBlock(source) => core::error::Error::source(source),
|
||||
_ => Option::None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,12 +15,11 @@ pub enum StateRootError {
|
||||
StorageRootError(StorageRootError),
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for StateRootError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for StateRootError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Database(source) => std::error::Error::source(source),
|
||||
Self::StorageRootError(source) => std::error::Error::source(source),
|
||||
Self::Database(source) => core::error::Error::source(source),
|
||||
Self::StorageRootError(source) => core::error::Error::source(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,11 +48,10 @@ impl From<StorageRootError> for DatabaseError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for StorageRootError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for StorageRootError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Database(source) => std::error::Error::source(source),
|
||||
Self::Database(source) => core::error::Error::source(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -76,12 +74,11 @@ impl From<StateProofError> for ProviderError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for StateProofError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for StateProofError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Database(source) => std::error::Error::source(source),
|
||||
Self::Rlp(source) => std::error::Error::source(source),
|
||||
Self::Database(source) => core::error::Error::source(source),
|
||||
Self::Rlp(source) => core::error::Error::source(source),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -112,12 +109,11 @@ impl From<TrieWitnessError> for ProviderError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for TrieWitnessError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for TrieWitnessError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Proof(source) => std::error::Error::source(source),
|
||||
Self::Rlp(source) => std::error::Error::source(source),
|
||||
Self::Proof(source) => core::error::Error::source(source),
|
||||
Self::Rlp(source) => core::error::Error::source(source),
|
||||
_ => Option::None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -305,7 +305,7 @@ pub fn write_json_file<T: Serialize>(path: &Path, obj: &T) -> Result<()> {
|
||||
pub fn atomic_write_file<F, E>(file_path: &Path, write_fn: F) -> Result<()>
|
||||
where
|
||||
F: FnOnce(&mut File) -> std::result::Result<(), E>,
|
||||
E: Into<Box<dyn std::error::Error + Send + Sync>>,
|
||||
E: Into<Box<dyn core::error::Error + Send + Sync>>,
|
||||
{
|
||||
let mut tmp_path = file_path.to_path_buf();
|
||||
tmp_path.set_extension("tmp");
|
||||
|
||||
@ -35,14 +35,14 @@ pub enum PayloadBuilderError {
|
||||
WithdrawalsBeforeShanghai,
|
||||
/// Any other payload building errors.
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl PayloadBuilderError {
|
||||
/// Create a new error from a boxed error.
|
||||
pub fn other<E>(error: E) -> Self
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
E: core::error::Error + Send + Sync + 'static,
|
||||
{
|
||||
Self::Other(Box::new(error))
|
||||
}
|
||||
@ -84,7 +84,7 @@ pub enum EngineObjectValidationError {
|
||||
UnsupportedFork,
|
||||
/// Another type of error that is not covered by the above variants.
|
||||
#[error("Invalid params: {0}")]
|
||||
InvalidParams(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
InvalidParams(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
/// Thrown when validating an execution payload OR payload attributes fails due to:
|
||||
@ -117,7 +117,7 @@ impl EngineObjectValidationError {
|
||||
/// Creates an instance of the `InvalidParams` variant with the given error.
|
||||
pub fn invalid_params<E>(error: E) -> Self
|
||||
where
|
||||
E: std::error::Error + Send + Sync + 'static,
|
||||
E: core::error::Error + Send + Sync + 'static,
|
||||
{
|
||||
Self::InvalidParams(Box::new(error))
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ pub trait PayloadBuilderAttributes: Send + Sync + std::fmt::Debug {
|
||||
/// [`PayloadBuilderAttributes::try_new`].
|
||||
type RpcPayloadAttributes;
|
||||
/// The error type used in [`PayloadBuilderAttributes::try_new`].
|
||||
type Error: std::error::Error;
|
||||
type Error: core::error::Error;
|
||||
|
||||
/// Creates a new payload builder for the given parent block and the attributes.
|
||||
///
|
||||
@ -164,7 +164,7 @@ pub trait PayloadAttributesBuilder: std::fmt::Debug + Send + Sync + 'static {
|
||||
/// The payload attributes type returned by the builder.
|
||||
type PayloadAttributes: PayloadAttributes;
|
||||
/// The error type returned by [`PayloadAttributesBuilder::build`].
|
||||
type Error: std::error::Error + Send + Sync;
|
||||
type Error: core::error::Error + Send + Sync;
|
||||
|
||||
/// Return a new payload attribute from the builder.
|
||||
fn build(&self) -> Result<Self::PayloadAttributes, Self::Error>;
|
||||
|
||||
@ -61,8 +61,7 @@ pub enum InvalidTransactionError {
|
||||
SignerAccountHasBytecode,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for InvalidTransactionError {}
|
||||
impl core::error::Error for InvalidTransactionError {}
|
||||
|
||||
/// Represents error variants that can happen when trying to convert a transaction to
|
||||
/// [`PooledTransactionsElement`](crate::PooledTransactionsElement)
|
||||
@ -87,5 +86,4 @@ pub enum TryFromRecoveredTransactionError {
|
||||
BlobSidecarMissing,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for TryFromRecoveredTransactionError {}
|
||||
impl core::error::Error for TryFromRecoveredTransactionError {}
|
||||
|
||||
@ -90,7 +90,7 @@ impl IpcClientBuilder {
|
||||
/// use jsonrpsee::{core::client::ClientT, rpc_params};
|
||||
/// use reth_ipc::client::IpcClientBuilder;
|
||||
///
|
||||
/// # async fn run_client() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
/// # async fn run_client() -> Result<(), Box<dyn core::error::Error + Send + Sync>> {
|
||||
/// let client = IpcClientBuilder::default().build("/tmp/my-uds").await?;
|
||||
/// let response: String = client.request("say_hello", rpc_params![]).await?;
|
||||
/// # Ok(()) }
|
||||
|
||||
@ -82,7 +82,7 @@ impl<T, S, Fut> IpcConnDriver<T, S, Fut> {
|
||||
impl<T, S> Future for IpcConnDriver<T, S, S::Future>
|
||||
where
|
||||
S: Service<String, Response = Option<String>> + Send + 'static,
|
||||
S::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
|
||||
S::Error: Into<Box<dyn core::error::Error + Send + Sync>>,
|
||||
S::Future: Send + Unpin,
|
||||
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
|
||||
{
|
||||
|
||||
@ -72,7 +72,7 @@ where
|
||||
Service: Service<
|
||||
String,
|
||||
Response = Option<String>,
|
||||
Error = Box<dyn std::error::Error + Send + Sync + 'static>,
|
||||
Error = Box<dyn core::error::Error + Send + Sync + 'static>,
|
||||
Future: Send + Unpin,
|
||||
> + Send,
|
||||
> + Send
|
||||
@ -86,7 +86,7 @@ where
|
||||
/// ```
|
||||
/// use jsonrpsee::RpcModule;
|
||||
/// use reth_ipc::server::Builder;
|
||||
/// async fn run_server() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
/// async fn run_server() -> Result<(), Box<dyn core::error::Error + Send + Sync>> {
|
||||
/// let server = Builder::default().build("/tmp/my-uds".into());
|
||||
/// let mut module = RpcModule::new(());
|
||||
/// module.register_method("say_hello", |_, _, _| "lo")?;
|
||||
@ -366,7 +366,7 @@ where
|
||||
/// response will be emitted via the `method_sink`.
|
||||
type Response = Option<String>;
|
||||
|
||||
type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
|
||||
type Error = Box<dyn core::error::Error + Send + Sync + 'static>;
|
||||
|
||||
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send>>;
|
||||
|
||||
@ -441,7 +441,7 @@ fn process_connection<'b, RpcMiddleware, HttpMiddleware>(
|
||||
+ Service<
|
||||
String,
|
||||
Response = Option<String>,
|
||||
Error = Box<dyn std::error::Error + Send + Sync + 'static>,
|
||||
Error = Box<dyn core::error::Error + Send + Sync + 'static>,
|
||||
>,
|
||||
<<HttpMiddleware as Layer<TowerServiceNoHttp<RpcMiddleware>>>::Service as Service<String>>::Future:
|
||||
Send + Unpin,
|
||||
@ -496,7 +496,7 @@ async fn to_ipc_service<S, T>(
|
||||
rx: mpsc::Receiver<String>,
|
||||
) where
|
||||
S: Service<String, Response = Option<String>> + Send + 'static,
|
||||
S::Error: Into<Box<dyn std::error::Error + Send + Sync>>,
|
||||
S::Error: Into<Box<dyn core::error::Error + Send + Sync>>,
|
||||
S::Future: Send + Unpin,
|
||||
T: AsyncRead + AsyncWrite + Unpin + Send + 'static,
|
||||
{
|
||||
@ -823,7 +823,7 @@ mod tests {
|
||||
async fn pipe_from_stream_with_bounded_buffer(
|
||||
pending: PendingSubscriptionSink,
|
||||
stream: BroadcastStream<usize>,
|
||||
) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||
) -> Result<(), Box<dyn core::error::Error + Send + Sync>> {
|
||||
let sink = pending.accept().await.unwrap();
|
||||
let closed = sink.closed();
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ pub enum EngineApiError {
|
||||
NewPayload(#[from] BeaconOnNewPayloadError),
|
||||
/// Encountered an internal error.
|
||||
#[error(transparent)]
|
||||
Internal(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
/// Fetching the payload failed
|
||||
#[error(transparent)]
|
||||
GetPayloadError(#[from] PayloadBuilderError),
|
||||
|
||||
@ -591,7 +591,7 @@ impl std::fmt::Display for RevertError {
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for RevertError {}
|
||||
impl core::error::Error for RevertError {}
|
||||
|
||||
/// A helper error type that's mainly used to mirror `geth` Txpool's error messages
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
@ -643,7 +643,7 @@ pub enum RpcPoolError {
|
||||
AddressAlreadyReserved,
|
||||
/// Other unspecified error
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl From<RpcPoolError> for jsonrpsee_types::error::ErrorObject<'static> {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
/// A trait to convert an error to an RPC error.
|
||||
#[cfg(feature = "jsonrpsee-types")]
|
||||
pub trait ToRpcError: std::error::Error + Send + Sync + 'static {
|
||||
pub trait ToRpcError: core::error::Error + Send + Sync + 'static {
|
||||
/// Converts the error to a JSON-RPC error object.
|
||||
fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static>;
|
||||
}
|
||||
|
||||
@ -133,12 +133,12 @@ pub enum StageError {
|
||||
/// These types of errors are caught by the [Pipeline][crate::Pipeline] and trigger a restart
|
||||
/// of the stage.
|
||||
#[error(transparent)]
|
||||
Recoverable(Box<dyn std::error::Error + Send + Sync>),
|
||||
Recoverable(Box<dyn core::error::Error + Send + Sync>),
|
||||
/// The stage encountered a fatal error.
|
||||
///
|
||||
/// These types of errors stop the pipeline.
|
||||
#[error(transparent)]
|
||||
Fatal(Box<dyn std::error::Error + Send + Sync>),
|
||||
Fatal(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl StageError {
|
||||
|
||||
@ -13,7 +13,7 @@ pub(crate) enum TestRunnerError {
|
||||
#[error(transparent)]
|
||||
Database(#[from] DatabaseError),
|
||||
#[error(transparent)]
|
||||
Internal(#[from] Box<dyn std::error::Error>),
|
||||
Internal(#[from] Box<dyn core::error::Error>),
|
||||
#[error(transparent)]
|
||||
Provider(#[from] ProviderError),
|
||||
}
|
||||
|
||||
@ -50,11 +50,10 @@ pub enum DatabaseError {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for DatabaseError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for DatabaseError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Write(err) => std::error::Error::source(err),
|
||||
Self::Write(err) => core::error::Error::source(err),
|
||||
_ => Option::None,
|
||||
}
|
||||
}
|
||||
@ -113,8 +112,7 @@ impl fmt::Display for DatabaseWriteError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for DatabaseWriteError {}
|
||||
impl core::error::Error for DatabaseWriteError {}
|
||||
|
||||
/// Database write operation type.
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
|
||||
@ -12,8 +12,7 @@ pub enum StorageLockError {
|
||||
Other(String),
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for StorageLockError {}
|
||||
impl core::error::Error for StorageLockError {}
|
||||
|
||||
/// TODO: turn into variant once `ProviderError`
|
||||
impl From<FsPathError> for StorageLockError {
|
||||
|
||||
@ -172,14 +172,13 @@ impl From<UnifiedStorageWriterError> for ProviderError {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl std::error::Error for ProviderError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for ProviderError {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
match self {
|
||||
Self::Database(source) => std::error::Error::source(source),
|
||||
Self::Rlp(source) => std::error::Error::source(source),
|
||||
Self::StorageLockError(source) => std::error::Error::source(source),
|
||||
Self::UnifiedStorageWriterError(source) => std::error::Error::source(source),
|
||||
Self::Database(source) => core::error::Error::source(source),
|
||||
Self::Rlp(source) => core::error::Error::source(source),
|
||||
Self::StorageLockError(source) => core::error::Error::source(source),
|
||||
Self::UnifiedStorageWriterError(source) => core::error::Error::source(source),
|
||||
_ => Option::None,
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ use thiserror::Error;
|
||||
#[derive(Error, Debug)]
|
||||
pub enum NippyJarError {
|
||||
#[error(transparent)]
|
||||
Internal(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Internal(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
#[error(transparent)]
|
||||
Disconnect(#[from] std::io::Error),
|
||||
#[error(transparent)]
|
||||
|
||||
@ -90,7 +90,7 @@ pub enum BlobStoreError {
|
||||
DecodeError(#[from] alloy_rlp::Error),
|
||||
/// Other implementation specific error.
|
||||
#[error(transparent)]
|
||||
Other(Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
/// Keeps track of the size of the blob store.
|
||||
|
||||
@ -10,7 +10,7 @@ pub type PoolResult<T> = Result<T, PoolError>;
|
||||
///
|
||||
/// For example during validation
|
||||
/// [`TransactionValidator::validate_transaction`](crate::validate::TransactionValidator::validate_transaction)
|
||||
pub trait PoolTransactionError: std::error::Error + Send + Sync {
|
||||
pub trait PoolTransactionError: core::error::Error + Send + Sync {
|
||||
/// Returns `true` if the error was caused by a transaction that is considered bad in the
|
||||
/// context of the transaction pool and warrants peer penalization.
|
||||
///
|
||||
@ -19,8 +19,8 @@ pub trait PoolTransactionError: std::error::Error + Send + Sync {
|
||||
}
|
||||
|
||||
// Needed for `#[error(transparent)]`
|
||||
impl std::error::Error for Box<dyn PoolTransactionError> {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
impl core::error::Error for Box<dyn PoolTransactionError> {
|
||||
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
|
||||
(**self).source()
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ pub enum PoolErrorKind {
|
||||
/// Any other error that occurred while inserting/validating a transaction. e.g. IO database
|
||||
/// error
|
||||
#[error(transparent)]
|
||||
Other(#[from] Box<dyn std::error::Error + Send + Sync>),
|
||||
Other(#[from] Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
// === impl PoolError ===
|
||||
@ -75,7 +75,10 @@ impl PoolError {
|
||||
}
|
||||
|
||||
/// Creates a new pool error with the `Other` kind.
|
||||
pub fn other(hash: TxHash, error: impl Into<Box<dyn std::error::Error + Send + Sync>>) -> Self {
|
||||
pub fn other(
|
||||
hash: TxHash,
|
||||
error: impl Into<Box<dyn core::error::Error + Send + Sync>>,
|
||||
) -> Self {
|
||||
Self { hash, kind: PoolErrorKind::Other(error.into()) }
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ pub enum TransactionValidationOutcome<T: PoolTransaction> {
|
||||
/// this transaction from ever becoming valid.
|
||||
Invalid(T, InvalidPoolTransactionError),
|
||||
/// An error occurred while trying to validate the transaction
|
||||
Error(TxHash, Box<dyn std::error::Error + Send + Sync>),
|
||||
Error(TxHash, Box<dyn core::error::Error + Send + Sync>),
|
||||
}
|
||||
|
||||
impl<T: PoolTransaction> TransactionValidationOutcome<T> {
|
||||
|
||||
Reference in New Issue
Block a user