Skip to content

Commit

Permalink
Add error logs.
Browse files Browse the repository at this point in the history
  • Loading branch information
lesa-telos committed Nov 10, 2024
1 parent 92810e5 commit bc93bc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
8 changes: 4 additions & 4 deletions translator/src/tasks/ship_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use futures_util::StreamExt;
use tokio::net::TcpStream;
use tokio::sync::mpsc;
use tokio_tungstenite::{MaybeTlsStream, WebSocketStream};
use tracing::debug;
use tracing::info;
use tracing::{debug, error, warn};

Check failure on line 8 in translator/src/tasks/ship_reader.rs

View workflow job for this annotation

GitHub Actions / Clippy

unused import: `warn`

Check warning on line 8 in translator/src/tasks/ship_reader.rs

View workflow job for this annotation

GitHub Actions / Check

unused import: `warn`

Check warning on line 8 in translator/src/tasks/ship_reader.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused import: `warn`

pub async fn ship_reader(
mut ws_rx: SplitStream<WebSocketStream<MaybeTlsStream<TcpStream>>>,
Expand All @@ -26,14 +26,14 @@ pub async fn ship_reader(
Some(Ok(msg)) => {
debug!("Received message {counter}, sending to raw ds pool...",);
// write to the channel
if raw_ds_tx.send(msg.into_data()).await.is_err() {
println!("Receiver dropped");
if let Err(e) = raw_ds_tx.send(msg.into_data()).await {
error!("Receiver dropped {:?}", e);
break;
}
debug!("Sent message {counter} to raw ds pool...");
}
Some(Err(e)) => {
println!("Error receiving message: {}", e);
error!("Error receiving message: {}", e);
break;
}
None => {
Expand Down
5 changes: 3 additions & 2 deletions translator/src/types/evm_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use antelope::serializer::Encoder;
use antelope::util::hex_to_bytes;
use antelope::StructPacker;
use serde::{Deserialize, Deserializer, Serialize};
use tracing::warn;

#[derive(Debug, Clone, Default, Serialize, Deserialize, StructPacker)]
pub struct RawAction {
Expand Down Expand Up @@ -175,11 +176,11 @@ impl PrintedReceipt {
let printed_receipt = serde_json::from_str::<PrintedReceipt>(extracted).unwrap();
Some(printed_receipt)
} else {
println!("End pattern not found.");
warn!("End pattern not found.");
None
}
} else {
println!("Start pattern not found.");
warn!("Start pattern not found.");
None
}
}
Expand Down
1 change: 1 addition & 0 deletions translator/src/types/translator_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ impl NameToAddressCache {
let address = Address::from(account_row.address.data);
self.cache.insert(index, address);
self.index_cache.insert(account_row.index, address);

return Ok(address);
} else {
warn!("Got empty rows for index {index}, retry attempt {i}");
Expand Down

0 comments on commit bc93bc4

Please sign in to comment.