Skip to content

Commit 3ffef55

Browse files
committed
fix: narrow empty except blocks and add explanatory comments
1 parent 52f137c commit 3ffef55

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/specify_cli/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1606,7 +1606,8 @@ def init(
16061606
# Clean up downloaded ZIP to avoid cache accumulation
16071607
try:
16081608
zip_path.unlink(missing_ok=True)
1609-
except Exception:
1609+
except OSError:
1610+
# Best-effort cleanup; failure to delete is non-fatal
16101611
pass
16111612
except PresetError:
16121613
console.print(f"[yellow]Warning:[/yellow] Preset '{preset}' not found in catalog. Skipping.")

src/specify_cli/presets.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,7 @@ def fetch_catalog(self, force_refresh: bool = False) -> Dict[str, Any]:
11451145
if metadata.get("catalog_url") == catalog_url:
11461146
return json.loads(self.cache_file.read_text())
11471147
except (json.JSONDecodeError, OSError):
1148+
# Cache is corrupt or unreadable; fall through to network fetch
11481149
pass
11491150

11501151
try:

0 commit comments

Comments
 (0)