rolled back error logging
This commit is contained in:
parent
69c9664eb5
commit
fe760a257d
1 changed files with 25 additions and 30 deletions
55
src/lib.rs
55
src/lib.rs
|
@ -86,39 +86,34 @@ pub async fn send_to_wc_task(
|
||||||
mut sender: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, tokio_tungstenite::tungstenite::Message>
|
mut sender: SplitSink<WebSocketStream<MaybeTlsStream<TcpStream>>, tokio_tungstenite::tungstenite::Message>
|
||||||
) {
|
) {
|
||||||
info!("From app is closed: {:?}", from_app.is_closed());
|
info!("From app is closed: {:?}", from_app.is_closed());
|
||||||
loop {
|
while let Ok(msg) = from_app.recv().await {
|
||||||
match from_app.recv().await {
|
#[cfg(debug_assertions)]
|
||||||
Ok(msg) => {
|
{
|
||||||
#[cfg(debug_assertions)]
|
info!("Sending message to socket!");
|
||||||
{
|
// serialized message
|
||||||
info!("Sending message to socket!");
|
match serde_json::to_string(&msg) {
|
||||||
// serialized message
|
Err(e) => error!("Could not serialize ApplicationMessage to JSON! {e}"),
|
||||||
match serde_json::to_string(&msg) {
|
Ok(msg) => {
|
||||||
Err(e) => error!("Could not serialize ApplicationMessage to JSON! {e}"),
|
if let Err(e) = sender.send(Message::text(msg)).await {
|
||||||
Ok(msg) => {
|
error!("Could not send text ApplicationMessage to websocket! Closing websocket\n{e}");
|
||||||
if let Err(e) = sender.send(Message::text(msg)).await {
|
break;
|
||||||
error!("Could not send text ApplicationMessage to websocket! Closing websocket\n{e}");
|
}
|
||||||
break;
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
#[cfg(not(debug_assertions))]
|
||||||
|
{
|
||||||
#[cfg(not(debug_assertions))]
|
match bincode::serialize(&msg) {
|
||||||
{
|
Err(e) => error!("Could not serialize ApplicationMessage into binary! {e}"),
|
||||||
match bincode::serialize(&msg) {
|
Ok(e) => {
|
||||||
Err(e) => error!("Could not serialize ApplicationMessage into binary! {e}"),
|
if let Err(e) = sender.send(Message::binary(msg)).await {
|
||||||
Ok(e) => {
|
error!("Could not send binary ApplicationMessage to websocket! Closing websocket\n{e}");
|
||||||
if let Err(e) = sender.send(Message::binary(msg)).await {
|
break;
|
||||||
error!("Could not send binary ApplicationMessage to websocket! Closing websocket\n{e}");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => error!("Send to WC had a recv error! {e}"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue