From ca67dc251f2fa1aa7e67171533ee78a11e31785d Mon Sep 17 00:00:00 2001 From: Psilon Date: Mon, 18 Feb 2019 20:39:38 +0300 Subject: [PATCH] Add message to IO errors (#10324) --- parity/upgrade.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parity/upgrade.rs b/parity/upgrade.rs index aa3f6eba1..ecd9beff1 100644 --- a/parity/upgrade.rs +++ b/parity/upgrade.rs @@ -28,9 +28,9 @@ use journaldb::Algorithm; #[derive(Debug)] pub enum Error { - CannotCreateConfigPath, - CannotWriteVersionFile, - CannotUpdateVersionFile, + CannotCreateConfigPath(io::Error), + CannotWriteVersionFile(io::Error), + CannotUpdateVersionFile(io::Error), SemVer(SemVerError), } @@ -105,7 +105,7 @@ fn with_locked_version(db_path: &str, script: F) -> Result where F: Fn(&Version) -> Result { let mut path = PathBuf::from(db_path); - create_dir_all(&path).map_err(|_| Error::CannotCreateConfigPath)?; + create_dir_all(&path).map_err(Error::CannotCreateConfigPath)?; path.push("ver.lock"); let version = @@ -118,11 +118,11 @@ fn with_locked_version(db_path: &str, script: F) -> Result }) .unwrap_or(Version::new(0, 9, 0)); - let mut lock = File::create(&path).map_err(|_| Error::CannotWriteVersionFile)?; + let mut lock = File::create(&path).map_err(Error::CannotWriteVersionFile)?; let result = script(&version); let written_version = Version::parse(CURRENT_VERSION)?; - lock.write_all(written_version.to_string().as_bytes()).map_err(|_| Error::CannotUpdateVersionFile)?; + lock.write_all(written_version.to_string().as_bytes()).map_err(Error::CannotUpdateVersionFile)?; result }