refactor: log swallowed exceptions across src/
Replace silent swallow-excepts (pass/return/continue) with logger.warning recording the caught error, preserving behaviour.
This commit is contained in:
49 files changed
+1004
-363
No files matched your search
@@ -8,6 +8,8 @@ Each plugin module exposes a PLUGIN variable pointing to its class.
|
||||
import importlib
|
||||
import pkgutil
|
||||
|
||||
from fabric.utils import logger
|
||||
|
||||
__all__ = []
|
||||
|
||||
for module_info in pkgutil.iter_modules(__path__):
|
||||
@@ -20,5 +22,7 @@ for module_info in pkgutil.iter_modules(__path__):
|
||||
if plugin_class is not None:
|
||||
globals()[module_name] = plugin_class
|
||||
__all__.append(module_name)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"[__init__] module = importlib.import_module(f'(__name__).(module_nam... failed: {e}"
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
from fabric.utils import DesktopApp, get_desktop_applications
|
||||
from fabric.utils import DesktopApp, get_desktop_applications, logger
|
||||
|
||||
from utils.functions import fuzzy_score
|
||||
from window.spotlight.api import SearchResult, SpotlightPlugin
|
||||
@@ -38,8 +38,10 @@ class ApplicationPlugin(SpotlightPlugin):
|
||||
try:
|
||||
self._desktop_apps = get_desktop_applications()
|
||||
self._apps_loaded_at = now
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"[application] self._desktop_apps = get_desktop_applications() failed: {e}"
|
||||
)
|
||||
|
||||
results: list[SearchResult] = []
|
||||
for app in self._desktop_apps:
|
||||
|
||||
@@ -2,6 +2,8 @@ import os
|
||||
import random
|
||||
from typing import Any
|
||||
|
||||
from fabric.utils import logger
|
||||
|
||||
from services.wallpaper import WallpaperService, create_thumbnail
|
||||
from shared.data import WALLPAPERS_THUMBNAILS_SIZE
|
||||
from utils.functions import fuzzy_filter
|
||||
@@ -71,7 +73,10 @@ class WallpaperPlugin(SpotlightPlugin):
|
||||
image_path, thumbnail_path, WALLPAPERS_THUMBNAILS_SIZE
|
||||
)
|
||||
thumbs_created += 1
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"[wallpapers] create_thumbnail( image_path, thumbnail_path, WALLPAPERS_... failed: {e}"
|
||||
)
|
||||
continue
|
||||
|
||||
filename = os.path.basename(image_path)
|
||||
|
||||
Reference in new issue
Block a user