feat(src/services): improve error handlingwith detailed logging

Replace silent exception swallowing with explicit logging via logger.error to aid debugging and observability
This commit is contained in:
sankalp committed 2026-06-17 05:20:44 +05:45
1 parent 260d215b6b
commit 48231b3bc2
5 files changed
+27 -25

No files matched your search

+5 -3
View File
@@ -1,3 +1,5 @@
from fabric.utils import logger
# Standard library imports
import json
import uuid
@@ -36,7 +38,7 @@ class TodoService(Service):
try:
callback(event_type, data)
except Exception as e:
print(f"Error in todo callback: {e}")
logger.error(f"Error in todo callback: {e}")
def _get_todos_file_path(self):
"""Returns the path to the todos JSON file"""
@@ -53,7 +55,7 @@ class TodoService(Service):
else:
self._todos = []
except Exception as e:
print(f"Error loading todos: {e}")
logger.error(f"Error loading todos: {e}")
self._todos = []
def _save_todos(self):
@@ -62,7 +64,7 @@ class TodoService(Service):
with open(self._file_path, "w", encoding="utf-8") as f:
json.dump(self._todos, f, indent=2, ensure_ascii=False)
except Exception as e:
print(f"Error saving todos: {e}")
logger.error(f"Error saving todos: {e}")
@Property(list, "readable")
def todos(self):