From ba9e8991eb6535ab2a95a3d5136ae3429134b053 Mon Sep 17 00:00:00 2001 From: Joseph Shearer Date: Fri, 4 Aug 2023 17:08:41 -0400 Subject: [PATCH] fix: serialization should never fail --- crates/derive/src/combine_api.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/derive/src/combine_api.rs b/crates/derive/src/combine_api.rs index 3845f965b1..1f595747f3 100644 --- a/crates/derive/src/combine_api.rs +++ b/crates/derive/src/combine_api.rs @@ -202,17 +202,15 @@ impl cgo::Service for API { // Update the "true" shape with the newly widened shape state.shape = state.scratch_shape.clone(); - match serde_json::to_value( + let serialized = serde_json::to_value( &SchemaBuilder::new(state.scratch_shape.clone()).root_schema(), - ) { - Ok(value) => tracing::info!( - inferred_schema = ?DebugJson(value), - "inferred schema updated" - ), - Err(err) => { - tracing::error!("failed to serialize inferred schema: {err:?}") - } - }; + ) + .expect("shape serialization should never fail"); + + tracing::info!( + inferred_schema = ?DebugJson(serialized), + "inferred schema updated" + ); } // Send a final message with accumulated stats.