chore: extract retherror to reth-errors (#8439)

This commit is contained in:
Matthias Seitz
2024-05-28 18:47:58 +02:00
committed by GitHub
parent 03c3d5182f
commit d78c5b71fd
7 changed files with 64 additions and 12 deletions

16
Cargo.lock generated
View File

@ -6887,6 +6887,18 @@ dependencies = [
"thiserror",
]
[[package]]
name = "reth-errors"
version = "0.2.0-beta.7"
dependencies = [
"reth-blockchain-tree-api",
"reth-consensus",
"reth-execution-errors",
"reth-fs-util",
"reth-storage-errors",
"thiserror",
]
[[package]]
name = "reth-eth-wire"
version = "0.2.0-beta.7"
@ -7107,13 +7119,11 @@ name = "reth-interfaces"
version = "0.2.0-beta.7"
dependencies = [
"reth-blockchain-tree-api",
"reth-consensus",
"reth-errors",
"reth-execution-errors",
"reth-fs-util",
"reth-network-p2p",
"reth-storage-errors",
"reth-testing-utils",
"thiserror",
]
[[package]]

View File

@ -11,6 +11,7 @@ members = [
"crates/consensus/consensus/",
"crates/e2e-test-utils/",
"crates/engine-primitives/",
"crates/errors/",
"crates/ethereum-forks/",
"crates/ethereum/consensus/",
"crates/ethereum/engine-primitives/",
@ -236,6 +237,7 @@ reth-downloaders = { path = "crates/net/downloaders" }
reth-e2e-test-utils = { path = "crates/e2e-test-utils" }
reth-ecies = { path = "crates/net/ecies" }
reth-engine-primitives = { path = "crates/engine-primitives" }
reth-errors = { path = "crates/errors" }
reth-eth-wire = { path = "crates/net/eth-wire" }
reth-eth-wire-types = { path = "crates/net/eth-wire-types" }
reth-ethereum-consensus = { path = "crates/ethereum/consensus" }

21
crates/errors/Cargo.toml Normal file
View File

@ -0,0 +1,21 @@
[package]
name = "reth-errors"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
[lints]
workspace = true
[dependencies]
reth-blockchain-tree-api.workspace = true
reth-consensus.workspace = true
reth-execution-errors.workspace = true
reth-fs-util.workspace = true
reth-storage-errors.workspace = true
# misc
thiserror.workspace = true

View File

@ -1,4 +1,4 @@
use crate::blockchain_tree::error::{BlockchainTreeError, CanonicalError};
use reth_blockchain_tree_api::error::{BlockchainTreeError, CanonicalError};
use reth_consensus::ConsensusError;
use reth_execution_errors::BlockExecutionError;
use reth_fs_util::FsPathError;

24
crates/errors/src/lib.rs Normal file
View File

@ -0,0 +1,24 @@
//! High level error types for the reth in general.
//!
//! ## Feature Flags
//!
//! - `test-utils`: Export utilities for testing
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
)]
#![cfg_attr(not(test), warn(unused_crate_dependencies))]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
mod error;
pub use error::{RethError, RethResult};
pub use reth_blockchain_tree_api::error::{BlockchainTreeError, CanonicalError};
pub use reth_consensus::ConsensusError;
pub use reth_execution_errors::BlockExecutionError;
pub use reth_storage_errors::{
db::DatabaseError,
provider::{ProviderError, ProviderResult},
};

View File

@ -12,17 +12,13 @@ workspace = true
[dependencies]
reth-blockchain-tree-api.workspace = true
reth-consensus.workspace = true
reth-execution-errors.workspace = true
reth-fs-util.workspace = true
reth-network-p2p.workspace = true
reth-storage-errors.workspace = true
reth-errors.workspace = true
reth-testing-utils = { workspace = true, optional = true }
# misc
thiserror.workspace = true
[features]
test-utils = ["reth-consensus/test-utils", "reth-network-p2p/test-utils", "reth-testing-utils"]
test-utils = ["reth-network-p2p/test-utils", "reth-testing-utils"]
clap = ["reth-storage-errors/clap"]

View File

@ -19,8 +19,7 @@ pub use reth_storage_errors::{db, provider};
pub use reth_execution_errors as executor;
/// Possible errors when interacting with the chain.
mod error;
pub use error::{RethError, RethResult};
pub use reth_errors::{RethError, RethResult};
/// P2P traits.
pub use reth_network_p2p as p2p;