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

Add error logs. #83

Merged
merged 2 commits into from
Nov 15, 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
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};

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
Loading