Skip to content

Commit

Permalink
Add stderr feedback when client ID not found
Browse files Browse the repository at this point in the history
  • Loading branch information
ettolrach committed Mar 15, 2024
1 parent 90c6766 commit b0f5c61
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions backend/src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ async fn call_remove_player(uuid: &str) {
async fn client_msg(client_id: &str, msg: Message) {
//println!("received message from {}: {:?}", client_id, msg); //debug

let message = match msg.to_str() {
Ok(v) => v,
Err(_) => return,
};
let Ok(message) = msg.to_str() else { return };

//println!("{message}");

Expand All @@ -95,7 +92,9 @@ async fn client_msg(client_id: &str, msg: Message) {
let _ = sender.send(Ok(Message::text(create_response(message, client_id).await)));
}
}
None => return,
None => {
eprintln!("Couldn't find game client in client hashmap! Client ID: {client_id}");
return
},
}
return;
}

0 comments on commit b0f5c61

Please sign in to comment.