From 7f403657aa318abc1705dc2680359b397cd908e3 Mon Sep 17 00:00:00 2001 From: Aleksei Voronov Date: Sat, 26 Aug 2023 18:01:24 +0200 Subject: [PATCH] Don't crash when cid isn't there Although I don't know why that would happen --- src/streaming.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/streaming.rs b/src/streaming.rs index b43aa6c..36feb4d 100644 --- a/src/streaming.rs +++ b/src/streaming.rs @@ -69,7 +69,7 @@ async fn extract_post_operations(commit: &Commit) -> Result> continue; } - let cid = op.cid.expect("cid is not there, what").to_string(); + let cid = op.cid.ok_or(anyhow!("cid is not there, how is that possible"))?.to_string(); if let Some((_, item)) = items.iter().find(|(cid, _)| Some(*cid) == op.cid) { let record: Record = ciborium::from_reader(&mut item.as_slice())?;