Skip to content

Commit

Permalink
fix: serialization should never fail
Browse files Browse the repository at this point in the history
  • Loading branch information
jshearer committed Aug 10, 2023
1 parent 3573705 commit ba9e899
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions crates/derive/src/combine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ba9e899

Please sign in to comment.