From a76b0e3c09b3bad965b8b06bc95d1464b82824b8 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 25 May 2020 10:30:04 +0200 Subject: [PATCH] src/rrd/rrd.rs: do not wrap error and return ErrorKind::NotFound --- src/rrd/cache.rs | 2 +- src/rrd/rrd.rs | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/rrd/cache.rs b/src/rrd/cache.rs index 0a39878b..a89d0615 100644 --- a/src/rrd/cache.rs +++ b/src/rrd/cache.rs @@ -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) }, diff --git a/src/rrd/rrd.rs b/src/rrd/rrd.rs index dbfb98aa..8f542b52 100644 --- a/src/rrd/rrd.rs +++ b/src/rrd/rrd.rs @@ -297,13 +297,8 @@ impl RRD { } pub fn load(path: &Path) -> Result { - 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) - }) + let raw = std::fs::read(path)?; + Self::from_raw(&raw) } pub fn save(&self, filename: &Path) -> Result<(), Error> {