Skip to content

Commit

Permalink
add detailed message when target folder path is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
linyihai committed Oct 13, 2023
1 parent 0871c0e commit cbf7723
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion crates/cargo-util/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,14 @@ pub fn create_dir_all_excluded_from_backups_atomic(p: impl AsRef<Path>) -> Resul
// we can infer from it's another cargo process doing work.
if let Err(e) = fs::rename(tempdir.path(), path) {
if !path.exists() {
return Err(anyhow::Error::from(e));
return Err(anyhow::Error::from(e))
.with_context(|| {
format!(
"the path `{}` is invalid or broken symbolic link",
path.display()
)
})
.with_context(|| format!("failed to create directory `{}`", path.display()));
}
}
Ok(())
Expand Down

0 comments on commit cbf7723

Please sign in to comment.