Skip to content
Snippets Groups Projects
Verified Commit af019b9a authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

[Cache] Add some more debugging and error logging

parent bdae34be
No related branches found
No related tags found
No related merge requests found
...@@ -273,7 +273,10 @@ impl UserInfo { ...@@ -273,7 +273,10 @@ impl UserInfo {
// Determine XDG directories now // Determine XDG directories now
let base_dirs = match BaseDirectories::with_prefix(BASE_NAME) { let base_dirs = match BaseDirectories::with_prefix(BASE_NAME) {
Ok(b) => b, 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 // Restore $HOME to original if we changed it earlier
...@@ -292,7 +295,10 @@ impl UserInfo { ...@@ -292,7 +295,10 @@ impl UserInfo {
fn place_user_cache_file(&mut self, filename: String) -> Result<PathBuf, io::Error> { fn place_user_cache_file(&mut self, filename: String) -> Result<PathBuf, io::Error> {
match self.get_user_xdg_base_directories() { match self.get_user_xdg_base_directories() {
Ok(b) => b.place_cache_file(filename), 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 { ...@@ -328,7 +334,7 @@ impl UserInfo {
/// write the token to disk afterwards /// write the token to disk afterwards
pub fn set_access_token(&mut self, token: BasicTokenResponse) -> Result<(), io::Error> { pub fn set_access_token(&mut self, token: BasicTokenResponse) -> Result<(), io::Error> {
self.access_token = Some(token.clone()); 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 // Try to write user's token cache file
// We need to ensure privileges were dropped successfully to avoid symlink attacks // We need to ensure privileges were dropped successfully to avoid symlink attacks
...@@ -339,9 +345,15 @@ impl UserInfo { ...@@ -339,9 +345,15 @@ impl UserInfo {
debug!("Storing token for in cache file"); debug!("Storing token for in cache file");
save_json(path, token) 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(); self.restore_privileges();
return res; return res;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment