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:
sankalp committed 2026-07-14 13:02:21 +05:45
1 parent c0a4b1b792
commit f72542a231
49 files changed
+1004 -363

No files matched your search

+12 -4
View File
@@ -140,8 +140,10 @@ class Brightness(Service):
self._brightness_path = base_path / "brightness"
self._max_brightness_path = base_path / "max_brightness"
return self._screen_device
except Exception:
pass
except Exception as e:
logger.warning(
f"[brightness] devices = os.listdir('/sys/class/backlight') failed: {e}"
)
return ""
def _detect_ddcutil_bus(self):
@@ -152,7 +154,10 @@ class Brightness(Service):
match = re.search(r"I2C bus:\s*/dev/i2c-(\d+)", process.stdout)
return int(match.group(1)) if match else -1
return -1
except Exception:
except Exception as e:
logger.warning(
f"[brightness] process = run_command(['ddcutil', 'detect'], timeout=2) failed: {e}"
)
return -1
def _read_max_brightness(self):
@@ -185,7 +190,10 @@ class Brightness(Service):
try:
if self._max_brightness_path and self._max_brightness_path.exists():
return int(self._max_brightness_path.read_text().strip())
except Exception:
except Exception as e:
logger.warning(
f"[brightness] if self._max_brightness_path and self._max_brightness_pat... failed: {e}"
)
return None
return None