From 84972c06d6f20b80af977ae1cbb779c4df58f357 Mon Sep 17 00:00:00 2001 From: kramo Date: Mon, 22 Dec 2025 20:54:13 +0100 Subject: [PATCH] sources: Handle all OSErrors when reading files --- cartridges/application.py | 2 +- cartridges/sources/heroic.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cartridges/application.py b/cartridges/application.py index 869e24f..9877ec8 100644 --- a/cartridges/application.py +++ b/cartridges/application.py @@ -39,7 +39,7 @@ class Application(Adw.Application): for source in sources: try: yield from source.get_games(skip_ids=skip_ids) - except FileNotFoundError: + except OSError: continue @override diff --git a/cartridges/sources/heroic.py b/cartridges/sources/heroic.py index e658a04..fcc6dfa 100644 --- a/cartridges/sources/heroic.py +++ b/cartridges/sources/heroic.py @@ -66,7 +66,7 @@ class _StoreSource(_Source): try: with (_config_dir() / cls._INSTALLED_PATH).open() as fp: data = json.load(fp) - except (FileNotFoundError, JSONDecodeError): + except (OSError, JSONDecodeError): return set() return set(cls._installed(data)) @@ -130,7 +130,7 @@ def _hidden_app_names() -> Generator[str]: try: with (_config_dir() / "store" / "config.json").open() as fp: config = json.load(fp) - except (FileNotFoundError, JSONDecodeError): + except (OSError, JSONDecodeError): return with suppress(TypeError, KeyError): @@ -145,7 +145,7 @@ def _games_from( try: with (_config_dir() / source.library_path()).open() as fp: library = json.load(fp) - except (FileNotFoundError, JSONDecodeError): + except (OSError, JSONDecodeError): return if not isinstance(library := library.get(source.LIBRARY_KEY), Iterable):