diff rust/hg-core/src/revset.rs @ 52069:652149ed64f0

rust: improve `InvalidRevision` error message I encountered this when debugging earlier and felt like we were losing some information along the way, which we were!
author Rapha?l Gom?s <rgomes@octobus.net>
date Tue, 01 Oct 2024 13:20:40 +0200
parents 4c5f6e95df84
children
line wrap: on
line diff
--- a/rust/hg-core/src/revset.rs	Mon Sep 30 17:19:35 2024 +0200
+++ b/rust/hg-core/src/revset.rs	Tue Oct 01 13:20:40 2024 +0200
@@ -28,9 +28,9 @@
     }
 
     match resolve_rev_number_or_hex_prefix(input, &changelog.revlog) {
-        Err(RevlogError::InvalidRevision) => {
+        Err(RevlogError::InvalidRevision(revision)) => {
             // TODO: support for the rest of the language here.
-            let msg = format!("cannot parse revset '{}'", input);
+            let msg = format!("cannot parse revset '{}'", revision);
             Err(HgError::unsupported(msg).into())
         }
         result => result,
@@ -67,5 +67,5 @@
         }
         return revlog.rev_from_node(prefix);
     }
-    Err(RevlogError::InvalidRevision)
+    Err(RevlogError::InvalidRevision(input.to_string()))
 }