Log error from AppendVec removal & a panic clean (#14302)
This commit is contained in:
parent
4af33674a7
commit
addffd7694
|
@ -117,7 +117,10 @@ pub struct AppendVec {
|
||||||
impl Drop for AppendVec {
|
impl Drop for AppendVec {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
if self.remove_on_drop {
|
if self.remove_on_drop {
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,19 +141,11 @@ impl AppendVec {
|
||||||
.create(create)
|
.create(create)
|
||||||
.open(file)
|
.open(file)
|
||||||
.map_err(|e| {
|
.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!(
|
panic!(
|
||||||
"{}Unable to {} data file {}, err {:?}",
|
"Unable to {} data file {} in current dir({:?}): {:?}",
|
||||||
msg,
|
|
||||||
if create { "create" } else { "open" },
|
if create { "create" } else { "open" },
|
||||||
file.display(),
|
file.display(),
|
||||||
|
std::env::current_dir(),
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue