Skip to content

Commit

Permalink
fixed todo message on network_metrics_server when fbs message is not …
Browse files Browse the repository at this point in the history
…parsed correctly by any parser
  • Loading branch information
alexisbatyk committed Oct 10, 2024
1 parent 9409485 commit 7322695
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/fdev/src/network_metrics_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async fn push_interface(ws: WebSocket, state: Arc<ServerState>) -> anyhow::Resul
_ => continue,
};

let mut decoding_errors = String::new(); // TODO: change this to Vec<String>
let mut decoding_errors = vec![];

match ContractChange::try_decode_fbs(&msg) {
Ok(ContractChange::PutFailure(_err)) => todo!(),
Expand All @@ -111,7 +111,8 @@ async fn push_interface(ws: WebSocket, state: Arc<ServerState>) -> anyhow::Resul
continue;
}
Err(decoding_error) => {
tracing::error!(%received_random_id, error = %decoding_error, "Failed to decode message from 1st ContractChange");
tracing::warn!(%received_random_id, error = %decoding_error, "Failed to decode message from 1st ContractChange");
decoding_errors.push(decoding_error.to_string());
}
}

Expand All @@ -131,15 +132,14 @@ async fn push_interface(ws: WebSocket, state: Arc<ServerState>) -> anyhow::Resul
continue;
}
Err(decoding_error) => {
tracing::error!(error = %decoding_error, "Failed to decode message");
decoding_errors.push_str(", ");
decoding_errors.push_str(&decoding_error.to_string());
tracing::warn!(error = %decoding_error, "Failed to decode message");
decoding_errors.push(decoding_error.to_string());
}
}

tracing::error!(%received_random_id, "The message was not decoded by any fbs type");
tx.send(Message::Binary(ControllerResponse::into_fbs_bytes(Err(
decoding_errors,
decoding_errors.join(", "),
))))
.await?;
}
Expand Down

0 comments on commit 7322695

Please sign in to comment.