From d84c817c6d48c9fb4595220ea10691bd329165f1 Mon Sep 17 00:00:00 2001 From: Maximilian Marx Date: Tue, 12 Dec 2023 10:23:31 +0100 Subject: [PATCH] Don't bail on non-parsing records --- helpers/rust/src/types/statistics.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helpers/rust/src/types/statistics.rs b/helpers/rust/src/types/statistics.rs index 7799a87..a8c59cf 100644 --- a/helpers/rust/src/types/statistics.rs +++ b/helpers/rust/src/types/statistics.rs @@ -148,8 +148,16 @@ impl DumpStatistics { log::trace!("parsing record: {raw_record:?}"); - let mut record: Record = - serde_json::from_str(raw_record).context("Failed parsing the record")?; + let record = serde_json::from_str::(raw_record); + + if let Err(error) = record { + log::warn!("Failed to parse record: {error}"); + log::debug!("{raw_record:?}"); + + return Ok(()); + } + + let mut record = record?; record.shrink_to_fit(); match record {