From 70361fe2d1b72374925c5f4bc488f4f8035e2795 Mon Sep 17 00:00:00 2001 From: Andrew Barnes Date: Thu, 5 Mar 2026 19:30:13 -0500 Subject: [PATCH] fix: use positional args in eprintln! format string Co-Authored-By: Claude Opus 4.6 --- .changeset/fix-discovery-cache-warning.md | 10 ++++++++++ src/discovery.rs | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .changeset/fix-discovery-cache-warning.md diff --git a/.changeset/fix-discovery-cache-warning.md b/.changeset/fix-discovery-cache-warning.md new file mode 100644 index 0000000..5b1ec92 --- /dev/null +++ b/.changeset/fix-discovery-cache-warning.md @@ -0,0 +1,10 @@ +--- +"@anthropic/gws": patch +--- + +Warn on stderr when discovery cache write fails + +Previously, the error from writing the discovery document cache was +silently discarded (`let _ = e`). Now prints a warning to stderr so +users are aware their cache is not persisting (e.g., due to disk full +or permission issues). diff --git a/src/discovery.rs b/src/discovery.rs index b4fa9ff..44dec5b 100644 --- a/src/discovery.rs +++ b/src/discovery.rs @@ -241,10 +241,9 @@ pub async fn fetch_discovery_document( alt_resp.text().await? }; - // Write to cache + // Write to cache (non-fatal — warn if it fails) if let Err(e) = std::fs::write(&cache_file, &body) { - // Non-fatal: just warn via stderr-safe approach - let _ = e; + eprintln!("warning: failed to write discovery cache to {}: {}", cache_file.display(), e); } let doc: RestDescription = serde_json::from_str(&body)?;