Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

chore: add some traces #1622

Merged
merged 2 commits into from
Aug 20, 2022
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
6 changes: 5 additions & 1 deletion ethers-providers/src/pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use std::{
pin::Pin,
task::{Context, Poll},
};
use tracing::error;

/// A transport implementation supporting pub sub subscriptions.
pub trait PubsubClient: JsonRpcClient {
Expand Down Expand Up @@ -90,7 +91,10 @@ where
match futures_util::ready!(this.rx.poll_next(ctx)) {
Some(item) => match serde_json::from_str(item.get()) {
Ok(res) => Poll::Ready(Some(res)),
_ => Poll::Pending,
Err(err) => {
error!("failed to deserialize item {:?}", err);
Poll::Pending
}
},
None => Poll::Ready(None),
}
Expand Down
2 changes: 2 additions & 0 deletions ethers-providers/src/transports/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::{
},
};
use thiserror::Error;
use tracing::trace;

use super::common::{Params, Response};

Expand Down Expand Up @@ -317,6 +318,7 @@ where
}

async fn handle_text(&mut self, inner: String) -> Result<(), ClientError> {
trace!(msg=?inner, "received message");
let (id, result) = match serde_json::from_str(&inner)? {
Response::Success { id, result } => (id, Ok(result.to_owned())),
Response::Error { id, error } => (id, Err(error)),
Expand Down