src/rrd/rrd.rs: do not wrap error and return ErrorKind::NotFound

This commit is contained in:
Dietmar Maurer 2020-05-25 10:30:04 +02:00
parent c25c9d8dd1
commit 3f23b17298
2 changed files with 3 additions and 8 deletions

View File

@ -58,7 +58,7 @@ pub fn update_value(rel_path: &str, value: f64, dst: DST) -> Result<(), Error> {
Ok(rrd) => rrd,
Err(err) => {
if err.kind() != std::io::ErrorKind::NotFound {
eprintln!("overwriting old RRD file, because of load error: {}", err);
eprintln!("overwriting RRD file {:?}, because of load error: {}", path, err);
}
RRD::new(dst)
},

View File

@ -297,13 +297,8 @@ impl RRD {
}
pub fn load(path: &Path) -> Result<Self, std::io::Error> {
proxmox::try_block!({
let raw = std::fs::read(path)?;
Self::from_raw(&raw)
}).map_err(|err| {
let msg = format!("RRD load {:?} failed - {}", path, err);
std::io::Error::new(std::io::ErrorKind::Other, msg)
})
}
pub fn save(&self, filename: &Path) -> Result<(), Error> {