Skip to content

Commit

Permalink
feat: remove thiserror (#735)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Oct 25, 2024
1 parent 330deeb commit 89a69a4
Show file tree
Hide file tree
Showing 16 changed files with 352 additions and 200 deletions.
85 changes: 33 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ op-alloy-protocol = { version = "0.5.1", default-features = false }
op-alloy-consensus = { version = "0.5.1", default-features = false }
op-alloy-rpc-types-engine = { version = "0.5.1", default-features = false }

# `no_std` support
thiserror = { git = "https://github.com/quartiq/thiserror", branch = "no-std", default-features = false }

# General
lru = "0.12.4"
spin = "0.9.8"
Expand Down
2 changes: 1 addition & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ workspace = true

[dependencies]
cfg-if.workspace = true
thiserror.workspace = true
derive_more = { workspace = true, features = ["full"] }
linked_list_allocator.workspace = true
8 changes: 4 additions & 4 deletions crates/common/src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! Errors for the `kona-common` crate.
use thiserror::Error;

/// An error that can occur when reading from or writing to a file descriptor.
#[derive(Error, Debug, PartialEq, Eq)]
#[error("IO error (errno: {0})")]
#[derive(derive_more::Display, Debug, PartialEq, Eq)]
#[display("IO error (errno: {_0})")]
pub struct IOError(pub i32);

impl core::error::Error for IOError {}

/// A [Result] type for the [IOError].
pub type IOResult<T> = Result<T, IOError>;
6 changes: 3 additions & 3 deletions crates/derive-alloy/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ lazy_static = { workspace = true, optional = true }
prometheus = { workspace = true, optional = true, features = ["process"] }

# `test-utils` feature dependencies
thiserror = { workspace = true, optional = true }
derive_more = { workspace = true, features = ["full"], optional = true }
alloy-rpc-client = { workspace = true, optional = true }
alloy-node-bindings = { workspace = true, optional = true }
alloy-transport-http = { workspace = true, optional = true, features = ["reqwest"] }

[dev-dependencies]
thiserror.workspace = true
derive_more = { workspace = true, features = ["full"] }
serde_json.workspace = true
alloy-rpc-client.workspace = true
alloy-node-bindings.workspace = true
Expand All @@ -60,7 +60,7 @@ kona-derive = { workspace = true, features = ["serde", "test-utils"] }
default = []
metrics = ["dep:prometheus", "dep:lazy_static"]
test-utils = [
"dep:thiserror",
"dep:derive_more",
"dep:alloy-rpc-client",
"dep:alloy-node-bindings",
"dep:alloy-transport-http",
Expand Down
10 changes: 6 additions & 4 deletions crates/derive-alloy/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ pub struct MockBeaconClient {
}

/// A mock beacon client error
#[derive(Debug, thiserror::Error)]
#[derive(Debug, derive_more::Display)]
pub enum MockBeaconClientError {
/// The config spec is not set
#[error("config_spec not set")]
#[display("config_spec not set")]
ConfigSpecNotSet,
/// The beacon genesis is not set
#[error("beacon_genesis not set")]
#[display("beacon_genesis not set")]
BeaconGenesisNotSet,
/// The blob sidecars are not set
#[error("blob_sidecars not set")]
#[display("blob_sidecars not set")]
BlobSidecarsNotSet,
}

impl core::error::Error for MockBeaconClientError {}

#[async_trait]
impl crate::BeaconClient for MockBeaconClient {
type Error = MockBeaconClientError;
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ op-alloy-consensus = { workspace = true, features = ["k256"] }
# General
brotli.workspace = true
tracing.workspace = true
thiserror.workspace = true
miniz_oxide.workspace = true
async-trait.workspace = true
unsigned-varint.workspace = true
alloc-no-stdlib.workspace = true
derive_more = { workspace = true, features = ["full"] }

# `serde` feature dependencies
serde = { workspace = true, optional = true, features = ["derive"] }
Expand Down
Loading

0 comments on commit 89a69a4

Please sign in to comment.