From b000a0972e39d9d48f4b5f649f2baf933ef53b93 Mon Sep 17 00:00:00 2001 From: Luke Anderson Date: Wed, 13 Mar 2019 13:38:28 +1100 Subject: [PATCH] Minor updates to Paul's comments. - Bubbled up home_dir not found error - Made comment show up in docs --- validator_client/src/config.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/validator_client/src/config.rs b/validator_client/src/config.rs index e400f228c..d9d30c64d 100644 --- a/validator_client/src/config.rs +++ b/validator_client/src/config.rs @@ -21,7 +21,8 @@ impl ClientConfig { /// Build a new configuration from defaults. pub fn default() -> Result { let data_dir = { - let home = dirs::home_dir().expect("Unable to determine home dir."); + let home = dirs::home_dir() + .ok_or(Error::new(ErrorKind::NotFound, "Unable to determine home directory."))?; home.join(DEFAULT_LIGHTHOUSE_DIR) }; fs::create_dir_all(&data_dir)?; @@ -39,7 +40,7 @@ impl ClientConfig { }) } - // Try to load keys from datadir, or fail + /// Try to load keys from key_dir, returning None if none are found or an error. pub fn fetch_keys(&self) -> Result>, Error> { let mut key_files = fs::read_dir(&self.key_dir)?.peekable();