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
@@ -301,7 +301,10 @@ class PluginLoader:
|
||||
"""Check if requirements.txt changed since last install."""
|
||||
try:
|
||||
return req_file.read_text() != marker_file.read_text()
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
f"[loader] return req_file.read_text() != marker_file.read_text() failed: {e}"
|
||||
)
|
||||
return True
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
|
||||
@@ -117,8 +117,10 @@ class SearchPipeline:
|
||||
with self._lock:
|
||||
try:
|
||||
self._pending_idle_ids.remove(source_id)
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(
|
||||
f"[search] self._pending_idle_ids.remove(source_id) failed: {e}"
|
||||
)
|
||||
callback(results)
|
||||
return False
|
||||
|
||||
@@ -133,8 +135,10 @@ class SearchPipeline:
|
||||
with self._lock:
|
||||
try:
|
||||
self._pending_idle_ids.remove(source_id)
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(
|
||||
f"[search] self._pending_idle_ids.remove(source_id) failed: {e}"
|
||||
)
|
||||
callback([])
|
||||
return False
|
||||
|
||||
@@ -178,8 +182,10 @@ class SearchPipeline:
|
||||
with self._lock:
|
||||
try:
|
||||
self._pending_idle_ids.remove(source_id)
|
||||
except ValueError:
|
||||
pass
|
||||
except ValueError as e:
|
||||
logger.warning(
|
||||
f"[search] self._pending_idle_ids.remove(source_id) failed: {e}"
|
||||
)
|
||||
_on_all_done()
|
||||
return False
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import os
|
||||
|
||||
from fabric.core import Signal
|
||||
from fabric.utils import Gdk, GLib
|
||||
from fabric.utils import Gdk, GLib, logger
|
||||
from fabric.widgets.box import Box
|
||||
from fabric.widgets.button import Button
|
||||
from fabric.widgets.entry import Entry
|
||||
@@ -265,8 +265,10 @@ class Spotlight(Box):
|
||||
return
|
||||
try:
|
||||
widget.disconnect_by_func(self.on_slot_enter)
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
except (TypeError, ValueError) as e:
|
||||
logger.warning(
|
||||
f"[main] widget.disconnect_by_func(self.on_slot_enter) failed: {e}"
|
||||
)
|
||||
self.viewport.remove(widget)
|
||||
widget.destroy()
|
||||
|
||||
@@ -544,8 +546,10 @@ class Spotlight(Box):
|
||||
for child in list(self.viewport.children):
|
||||
try:
|
||||
child.disconnect_by_func(self.on_slot_enter)
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
except (TypeError, ValueError) as e:
|
||||
logger.warning(
|
||||
f"[main] child.disconnect_by_func(self.on_slot_enter) failed: {e}"
|
||||
)
|
||||
self.viewport.remove(child)
|
||||
child.destroy()
|
||||
self._result_widgets.clear()
|
||||
|
||||
@@ -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