Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: remove anyhow #1402

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ readme.workspace = true
publish = true

[dependencies]
anyhow = "1"
async-trait = "0.1"
beef = { version = "0.5.1", features = ["impl_serde"] }
jsonrpsee-types = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion core/src/client/async_client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ where
}
_ = inactivity_stream.next() => {
if inactivity_check.is_inactive() {
break Err(Error::Transport(anyhow::anyhow!("WebSocket ping/pong inactive")));
break Err(Error::Transport("WebSocket ping/pong inactive".into()));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/client/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

//! Error type for client(s).

use crate::{params::EmptyBatchRequest, RegisterMethodError};
use crate::{params::EmptyBatchRequest, BoxError, RegisterMethodError};
use jsonrpsee_types::{ErrorObjectOwned, InvalidRequestId};
use std::sync::Arc;

Expand All @@ -37,8 +37,8 @@ pub enum Error {
#[error("{0}")]
Call(#[from] ErrorObjectOwned),
/// Networking error or error on the low-level protocol layer.
#[error("{0}")]
Transport(#[source] anyhow::Error),
#[error(transparent)]
Transport(BoxError),
/// The background task has been terminated.
#[error("The background task closed {0}; restart required")]
RestartNeeded(Arc<Error>),
Expand Down
2 changes: 0 additions & 2 deletions server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ readme.workspace = true
publish = true

[dependencies]
anyhow = "1"
futures-util = { version = "0.3.14", default-features = false, features = ["io", "async-await-macro"] }
jsonrpsee-types = { workspace = true }
jsonrpsee-core = { workspace = true, features = ["server", "http-helpers"] }
Expand All @@ -36,7 +35,6 @@ route-recognizer = "0.3.1"
pin-project = "1.1.3"

[dev-dependencies]
anyhow = "1"
jsonrpsee-test-utils = { path = "../test-utils" }
rand = "0.8"
tracing-subscriber = { version = "0.3.3", features = ["env-filter"] }
Expand Down
2 changes: 1 addition & 1 deletion server/src/middleware/http/proxy_get_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ where
let mut bytes = Vec::new();

while let Some(frame) = body.frame().await {
let data = frame?.into_data().map_err(|e| anyhow::anyhow!("{:?}", e))?;
let data = frame?.into_data().map_err(|e| format!("{e:?}"))?;
bytes.extend(data);
}

Expand Down
6 changes: 1 addition & 5 deletions server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,11 +839,7 @@ impl<HttpMiddleware, RpcMiddleware> Builder<HttpMiddleware, RpcMiddleware> {
/// // Call the jsonrpsee service which
/// // may upgrade it to a WebSocket connection
/// // or treat it as "ordinary HTTP request".
/// //
/// // https://github.com/rust-lang/rust/issues/102211 the error type can't be inferred
/// // to be `Box<dyn std::error::Error + Send + Sync>` so we need to convert it to a concrete type
/// // as workaround.
/// async move { svc.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) }
/// async move { svc.call(req).await }
/// });
///
/// // Upgrade the connection to a HTTP service with graceful shutdown.
Expand Down
7 changes: 2 additions & 5 deletions server/src/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,9 @@ pub(crate) async fn ws_server_with_stats(metrics: Metrics) -> SocketAddr {
tokio::join!(session_close2, session_close1);
metrics.ws_sessions_closed.fetch_add(1, Ordering::SeqCst);
});

async move { rpc_svc.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) }.boxed()
} else {
// HTTP.
async move { rpc_svc.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) }.boxed()
}

async move { rpc_svc.call(req).await }.boxed()
});

tokio::spawn(serve_with_graceful_shutdown(sock, svc, stop_handle.clone().shutdown()));
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ pub async fn server() -> SocketAddr {
.connection_id(connection_id)
.build(methods2.clone(), stop_hdl2.clone());

async move { tower_service.call(req).await.map_err(|e| anyhow::anyhow!("{:?}", e)) }
async move { tower_service.call(req).await }
});

// Spawn a new task to serve each respective (Hyper) connection.
Expand Down
Loading