From 9ea5e788525154979933ffe7cd461dd4bf97794e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Mon, 28 Dec 2020 22:51:57 +0000 Subject: [PATCH] Log error from AppendVec removal & a panic clean (bp #14302) (#14309) * Log error from AppendVec removal & a panic clean (#14302) (cherry picked from commit addffd7694109fb22346ccb82c37f7c647a1190f) # Conflicts: # runtime/src/append_vec.rs * fix conflict? (blind commit!) Co-authored-by: Ryo Onodera --- runtime/src/append_vec.rs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/runtime/src/append_vec.rs b/runtime/src/append_vec.rs index d6cb97e11a..26673cf35c 100644 --- a/runtime/src/append_vec.rs +++ b/runtime/src/append_vec.rs @@ -115,7 +115,10 @@ pub struct AppendVec { impl Drop for AppendVec { fn drop(&mut self) { - let _ignored = remove_file(&self.path); + if let Err(e) = remove_file(&self.path) { + // promote this to panic soon. + error!("AppendVec failed to remove {:?}: {:?}", &self.path, e); + } } } @@ -135,19 +138,11 @@ impl AppendVec { .create(create) .open(file) .map_err(|e| { - let mut msg = format!("in current dir {:?}\n", std::env::current_dir()); - for ancestor in file.ancestors() { - msg.push_str(&format!( - "{:?} is {:?}\n", - ancestor, - std::fs::metadata(ancestor) - )); - } panic!( - "{}Unable to {} data file {}, err {:?}", - msg, + "Unable to {} data file {} in current dir({:?}): {:?}", if create { "create" } else { "open" }, file.display(), + std::env::current_dir(), e ); })