diff --git a/src/cache.rs b/src/cache.rs index 9256531f68c061e255854fcfe741266e8a2fdedc..dcdaeb35bb5f7ba89f00aaf52cc1f2fc4c67b5bf 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -273,7 +273,10 @@ impl UserInfo { // Determine XDG directories now let base_dirs = match BaseDirectories::with_prefix(BASE_NAME) { Ok(b) => b, - Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)) + Err(e) => { + error!("Could not determine XDG base directories: {}", e); + return Err(io::Error::new(io::ErrorKind::Other, e)); + } }; // Restore $HOME to original if we changed it earlier @@ -292,7 +295,10 @@ impl UserInfo { fn place_user_cache_file(&mut self, filename: String) -> Result<PathBuf, io::Error> { match self.get_user_xdg_base_directories() { Ok(b) => b.place_cache_file(filename), - Err(e) => Err(e) + Err(e) => { + error!("Error placing cache file {}: {}", filename, e); + Err(e) + } } } @@ -328,7 +334,7 @@ impl UserInfo { /// write the token to disk afterwards pub fn set_access_token(&mut self, token: BasicTokenResponse) -> Result<(), io::Error> { self.access_token = Some(token.clone()); - debug!("Saved token for in memory"); + debug!("Saved token in memory"); // Try to write user's token cache file // We need to ensure privileges were dropped successfully to avoid symlink attacks @@ -339,9 +345,15 @@ impl UserInfo { debug!("Storing token for in cache file"); save_json(path, token) }, - Err(e) => Err(e) + Err(e) => { + error!("Error getting cache path in user home: {}", e); + Err(e) + } }, - Err(e) => Err(e) + Err(e) => { + error!("Error dropping privileges to store token in user home: {}", e); + Err(e) + } }; self.restore_privileges(); return res;