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:
12
src/integrations/chat_bridge/vendors/discord.py
vendored
12
src/integrations/chat_bridge/vendors/discord.py
vendored
@@ -87,7 +87,8 @@ if _DISCORD_UI_AVAILABLE:
|
||||
await action["target"].send(
|
||||
f"Action `{action['tool_name']}` timed out and was auto-rejected."
|
||||
)
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("Discord action timeout message error: %s", exc)
|
||||
pass
|
||||
|
||||
|
||||
@@ -186,7 +187,8 @@ class DiscordVendor(ChatPlatform):
|
||||
if self._client and not self._client.is_closed():
|
||||
try:
|
||||
await self._client.close()
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("Discord client close error: %s", exc)
|
||||
pass
|
||||
self._client = None
|
||||
|
||||
@@ -330,7 +332,8 @@ class DiscordVendor(ChatPlatform):
|
||||
|
||||
if settings.discord_token:
|
||||
return settings.discord_token
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("Discord token load error: %s", exc)
|
||||
pass
|
||||
|
||||
# 2. Fall back to state file (set via /discord/setup endpoint)
|
||||
@@ -458,7 +461,8 @@ class DiscordVendor(ChatPlatform):
|
||||
req.reject(note="User rejected from Discord")
|
||||
try:
|
||||
await continue_chat(action["run_output"], action.get("session_id"))
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("Discord continue chat error: %s", exc)
|
||||
pass
|
||||
|
||||
await interaction.response.send_message(
|
||||
|
||||
@@ -56,7 +56,8 @@ class TelegramBot:
|
||||
from config import settings
|
||||
|
||||
return settings.telegram_token or None
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
logger.warning("Telegram token load error: %s", exc)
|
||||
return None
|
||||
|
||||
def save_token(self, token: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user