src/rrd/rrd.rs: do not wrap error and return ErrorKind::NotFound
This commit is contained in:
parent
c25c9d8dd1
commit
3f23b17298
@ -58,7 +58,7 @@ pub fn update_value(rel_path: &str, value: f64, dst: DST) -> Result<(), Error> {
|
|||||||
Ok(rrd) => rrd,
|
Ok(rrd) => rrd,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
if err.kind() != std::io::ErrorKind::NotFound {
|
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)
|
RRD::new(dst)
|
||||||
},
|
},
|
||||||
|
@ -297,13 +297,8 @@ impl RRD {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(path: &Path) -> Result<Self, std::io::Error> {
|
pub fn load(path: &Path) -> Result<Self, std::io::Error> {
|
||||||
proxmox::try_block!({
|
let raw = std::fs::read(path)?;
|
||||||
let raw = std::fs::read(path)?;
|
Self::from_raw(&raw)
|
||||||
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> {
|
pub fn save(&self, filename: &Path) -> Result<(), Error> {
|
||||||
|
Loading…
Reference in New Issue
Block a user