record-daemon: fix event subscribe

This commit is contained in:
vhaudiquet committed 2026-03-19 21:38:40 +01:00
1 parent 2ddb953321
commit 7e346a33e0
2 files changed
+152 -25

No files matched your search

+8 -1
View File
@@ -276,7 +276,14 @@ pub enum EventData {
impl GameEvent {
/// Parse a game event from raw WebSocket data.
pub fn from_json(value: &serde_json::Value) -> Option<Self> {
serde_json::from_value(value.clone()).ok()
match serde_json::from_value(value.clone()) {
Ok(event) => Some(event),
Err(e) => {
// Log the parsing error for debugging
tracing::warn!("Failed to parse game event: {}. Data: {:?}", e, value);
None
}
}
}
/// Check if this event is relevant for recording.