From be08707a3a1fa616498fff5233f69035be4c12d4 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Thu, 31 Aug 2023 11:01:47 -0700 Subject: [PATCH] op_heads_store: propagate errors from `OpStore` --- lib/src/op_heads_store.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/op_heads_store.rs b/lib/src/op_heads_store.rs index 9aef7ce87..83d688d7e 100644 --- a/lib/src/op_heads_store.rs +++ b/lib/src/op_heads_store.rs @@ -89,7 +89,7 @@ pub fn resolve_op_heads( if op_heads.len() == 1 { let operation_id = op_heads.pop().unwrap(); - let operation = op_store.read_operation(&operation_id).unwrap(); + let operation = op_store.read_operation(&operation_id)?; return Ok(Operation::new(op_store.clone(), operation_id, operation)); } @@ -110,17 +110,17 @@ pub fn resolve_op_heads( if op_head_ids.len() == 1 { let op_head_id = op_head_ids[0].clone(); - let op_head = op_store.read_operation(&op_head_id).unwrap(); + let op_head = op_store.read_operation(&op_head_id)?; return Ok(Operation::new(op_store.clone(), op_head_id, op_head)); } let op_heads = op_head_ids .iter() - .map(|op_id: &OperationId| { - let data = op_store.read_operation(op_id).unwrap(); - Operation::new(op_store.clone(), op_id.clone(), data) + .map(|op_id: &OperationId| -> Result { + let data = op_store.read_operation(op_id)?; + Ok(Operation::new(op_store.clone(), op_id.clone(), data)) }) - .collect_vec(); + .try_collect()?; let mut op_heads = op_heads_store.handle_ancestor_ops(op_heads); // Return without creating a merge operation