From 5346bd734fa2594392ead6060f8766ffe3bbdd68 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 6 Jul 2023 14:01:25 +0900 Subject: [PATCH] git_backend: translate io::Error of read_conflict() to ReadObject error This is the last place in Git backend where io::Error is magically converted to BackendError::Other. --- lib/src/git_backend.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index 814ad013e..e1607d75f 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -531,7 +531,12 @@ impl Backend for GitBackend { &FileId::new(id.to_bytes()), )?; let mut data = String::new(); - file.read_to_string(&mut data)?; + file.read_to_string(&mut data) + .map_err(|err| BackendError::ReadObject { + object_type: "conflict".to_owned(), + hash: id.hex(), + source: err.into(), + })?; let json: serde_json::Value = serde_json::from_str(&data).unwrap(); Ok(Conflict { removes: conflict_term_list_from_json(json.get("removes").unwrap()),