chore: add some traces (#1622)
* chore: add some traces * Update ethers-providers/src/transports/ws.rs Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
This commit is contained in:
parent
8abb9d86e2
commit
da8c70ab7f
|
@ -12,6 +12,7 @@ use std::{
|
||||||
pin::Pin,
|
pin::Pin,
|
||||||
task::{Context, Poll},
|
task::{Context, Poll},
|
||||||
};
|
};
|
||||||
|
use tracing::error;
|
||||||
|
|
||||||
/// A transport implementation supporting pub sub subscriptions.
|
/// A transport implementation supporting pub sub subscriptions.
|
||||||
pub trait PubsubClient: JsonRpcClient {
|
pub trait PubsubClient: JsonRpcClient {
|
||||||
|
@ -90,7 +91,10 @@ where
|
||||||
match futures_util::ready!(this.rx.poll_next(ctx)) {
|
match futures_util::ready!(this.rx.poll_next(ctx)) {
|
||||||
Some(item) => match serde_json::from_str(item.get()) {
|
Some(item) => match serde_json::from_str(item.get()) {
|
||||||
Ok(res) => Poll::Ready(Some(res)),
|
Ok(res) => Poll::Ready(Some(res)),
|
||||||
_ => Poll::Pending,
|
Err(err) => {
|
||||||
|
error!("failed to deserialize item {:?}", err);
|
||||||
|
Poll::Pending
|
||||||
|
}
|
||||||
},
|
},
|
||||||
None => Poll::Ready(None),
|
None => Poll::Ready(None),
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ use std::{
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
use tracing::trace;
|
||||||
|
|
||||||
use super::common::{Params, Response};
|
use super::common::{Params, Response};
|
||||||
|
|
||||||
|
@ -317,6 +318,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn handle_text(&mut self, inner: String) -> Result<(), ClientError> {
|
async fn handle_text(&mut self, inner: String) -> Result<(), ClientError> {
|
||||||
|
trace!(msg=?inner, "received message");
|
||||||
let (id, result) = match serde_json::from_str(&inner)? {
|
let (id, result) = match serde_json::from_str(&inner)? {
|
||||||
Response::Success { id, result } => (id, Ok(result.to_owned())),
|
Response::Success { id, result } => (id, Ok(result.to_owned())),
|
||||||
Response::Error { id, error } => (id, Err(error)),
|
Response::Error { id, error } => (id, Err(error)),
|
||||||
|
|
Loading…
Reference in New Issue