diff rust/rhg/src/commands/status.rs @ 49374:455fce57e89e stable

rust: don't swallow valuable error information This helps when diagnosing corruption, and is in general good practice. The information is here, valuable and can be used easily.
author Rapha?l Gom?s <rgomes@octobus.net>
date Wed, 18 May 2022 15:53:28 +0100
parents 4d3f6767319f
children b07465adbcc8
line wrap: on
line diff
--- a/rust/rhg/src/commands/status.rs	Wed May 18 09:50:39 2022 +0100
+++ b/rust/rhg/src/commands/status.rs	Wed May 18 15:53:28 2022 +0100
@@ -517,10 +517,13 @@
     }
     let filelog = repo.filelog(hg_path)?;
     let fs_len = fs_metadata.len();
-    let filelog_entry =
-        filelog.entry_for_node(entry.node_id()?).map_err(|_| {
-            HgError::corrupted("filelog missing node from manifest")
-        })?;
+    let file_node = entry.node_id()?;
+    let filelog_entry = filelog.entry_for_node(file_node).map_err(|_| {
+        HgError::corrupted(format!(
+            "filelog missing node {:?} from manifest",
+            file_node
+        ))
+    })?;
     if filelog_entry.file_data_len_not_equal_to(fs_len) {
         // No need to read file contents:
         // it cannot be equal if it has a different length.