From 3ffef559542abddb8e937d5a1f109a53d92b31b4 Mon Sep 17 00:00:00 2001 From: Manfred Riem <15701806+mnriem@users.noreply.github.com> Date: Tue, 10 Mar 2026 15:16:43 -0500 Subject: [PATCH] fix: narrow empty except blocks and add explanatory comments --- src/specify_cli/__init__.py | 3 ++- src/specify_cli/presets.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/specify_cli/__init__.py b/src/specify_cli/__init__.py index a7746fd0..41220226 100644 --- a/src/specify_cli/__init__.py +++ b/src/specify_cli/__init__.py @@ -1606,7 +1606,8 @@ def init( # Clean up downloaded ZIP to avoid cache accumulation try: zip_path.unlink(missing_ok=True) - except Exception: + except OSError: + # Best-effort cleanup; failure to delete is non-fatal pass except PresetError: console.print(f"[yellow]Warning:[/yellow] Preset '{preset}' not found in catalog. Skipping.") diff --git a/src/specify_cli/presets.py b/src/specify_cli/presets.py index 5140865b..474df563 100644 --- a/src/specify_cli/presets.py +++ b/src/specify_cli/presets.py @@ -1145,6 +1145,7 @@ class PresetCatalog: if metadata.get("catalog_url") == catalog_url: return json.loads(self.cache_file.read_text()) except (json.JSONDecodeError, OSError): + # Cache is corrupt or unreadable; fall through to network fetch pass try: