forked from Rockachopa/Timmy-time-dashboard
fix: replace 59 bare except clauses with proper logging (#25)
All `except Exception:` now catch as `except Exception as exc:` with appropriate logging (warning for critical paths, debug for graceful degradation). Added logger setup to 4 files that lacked it: - src/timmy/memory/vector_store.py - src/dashboard/middleware/csrf.py - src/dashboard/middleware/security_headers.py - src/spark/memory.py 31 files changed across timmy core, dashboard, infrastructure, integrations. Zero bare excepts remain. 1340 tests passing.
This commit is contained in:
@@ -54,7 +54,8 @@ class WebSocketManager:
|
||||
for event in list(self._event_history)[-20:]:
|
||||
try:
|
||||
await websocket.send_text(event.to_json())
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("WebSocket history send error: %s", exc)
|
||||
break
|
||||
|
||||
def disconnect(self, websocket: WebSocket) -> None:
|
||||
@@ -83,8 +84,8 @@ class WebSocketManager:
|
||||
await ws.send_text(message)
|
||||
except ConnectionError:
|
||||
disconnected.append(ws)
|
||||
except Exception:
|
||||
logger.warning("Unexpected WebSocket send error", exc_info=True)
|
||||
except Exception as exc:
|
||||
logger.warning("Unexpected WebSocket send error: %s", exc)
|
||||
disconnected.append(ws)
|
||||
|
||||
# Clean up dead connections
|
||||
@@ -156,7 +157,8 @@ class WebSocketManager:
|
||||
try:
|
||||
await ws.send_text(message)
|
||||
count += 1
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("WebSocket direct send error: %s", exc)
|
||||
disconnected.append(ws)
|
||||
|
||||
# Clean up dead connections
|
||||
|
||||
Reference in New Issue
Block a user