diff --git a/.changeset/fix-issue-493-token-dir-error.md b/.changeset/fix-issue-493-token-dir-error.md new file mode 100644 index 00000000..7909f9b1 --- /dev/null +++ b/.changeset/fix-issue-493-token-dir-error.md @@ -0,0 +1 @@ +---\n"@googleworkspace/cli": patch\n---\n\nfix(auth): propagate error when token directory cannot be created diff --git a/src/token_storage.rs b/src/token_storage.rs index 1cfa5bf1..59694199 100644 --- a/src/token_storage.rs +++ b/src/token_storage.rs @@ -82,7 +82,13 @@ impl EncryptedTokenStorage { let encrypted = crate::credential_store::encrypt(json.as_bytes())?; if let Some(parent) = self.file_path.parent() { - let _ = tokio::fs::create_dir_all(parent).await; + tokio::fs::create_dir_all(parent).await.map_err(|e| { + anyhow::anyhow!( + "Failed to create token directory '{}': {}", + parent.display(), + e + ) + })?; #[cfg(unix)] { use std::os::unix::fs::PermissionsExt;