Skip to content

Commit 7825caf

Browse files
committed
chore: add recived path into panic info
1 parent cbba833 commit 7825caf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ pub fn is_dependency_tree_root<'a>(manifest: &'a Manifest, locator: &'a PackageL
195195
}
196196

197197
pub fn find_locator<'a>(manifest: &'a Manifest, path: &Path) -> Option<&'a PackageLocator> {
198-
let rel_path = pathdiff::diff_paths(path, &manifest.manifest_dir)
199-
.expect("Assertion failed: Provided path should be absolute");
198+
let rel_path = pathdiff::diff_paths(path, &manifest.manifest_dir).unwrap_or_else(|| {
199+
panic!("Assertion failed: Provided path should be absolute but received {}", path.display())
200+
});
200201

201202
if let Some(regex) = &manifest.ignore_pattern_data {
202203
if regex.0.is_match(&util::normalize_path(rel_path.to_string_lossy())).unwrap() {

0 commit comments

Comments
 (0)