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)?;