refactor(modules): improve exception handling and simplify service usage
Enhancements - Replace bare `except:` with `except Exception:` in multiple modules- Cast step calculation to `int` for consistent type - Simplify `get_battery_icon_file` to return a string directly - Use `get_todo_service()` instead of module-level `todo_service` throughout todo widget - Remove unused `"zen": "zen-browser"` mapping entry Bug Fixes - Prevent bare exception swallowing by catching `Exception` explicitly - Ensure proper cleanup of timer IDs and other resources - Delete unused modules/osdd components New Features - None
This commit is contained in:
34 files changed
+682
-519
No files matched your search
@@ -29,9 +29,9 @@ def get_battery_icon_file(
|
||||
Relative path to the battery icon file
|
||||
"""
|
||||
clamped = max(0, min(100, percentage))
|
||||
step = (clamped // 10) * 10
|
||||
step = int((clamped // 10) * 10)
|
||||
filename = f"battery-{step:03d}{'-charging' if is_charging else ''}.svg"
|
||||
return svg_file(f"battery/{filename}")
|
||||
return f"battery/{filename}"
|
||||
|
||||
|
||||
def set_bluetooth_enabled_with_fallback(client, enabled: bool):
|
||||
@@ -518,7 +518,7 @@ class BluetoothConnections(Box):
|
||||
# Make sure other devices revealer is collapsed when closing
|
||||
try:
|
||||
self.other_devices_revealer.child_revealed = False
|
||||
except:
|
||||
except Exception:
|
||||
pass # Widget might already be destroyed
|
||||
|
||||
def close_bluetooth(self):
|
||||
|
||||
Reference in new issue
Block a user