Skip to content

Fix error handling in token-spy db_postgres.py#479

Closed
bugman-007 wants to merge 1 commit intoLight-Heart-Labs:mainfrom
bugman-007:fix/token-spy-postgres-error-handling
Closed

Fix error handling in token-spy db_postgres.py#479
bugman-007 wants to merge 1 commit intoLight-Heart-Labs:mainfrom
bugman-007:fix/token-spy-postgres-error-handling

Conversation

@bugman-007
Copy link
Copy Markdown
Contributor

Summary

  • Replace broad except Exception: with specific database exceptions per CLAUDE.md error handling rules
  • Affects PostgreSQL database operations in token-spy service

Changes

  • _get_or_create_agent(): Catch psycopg2.DatabaseError and psycopg2.OperationalError instead of Exception
  • log_usage(): Catch psycopg2.DatabaseError and psycopg2.OperationalError instead of Exception

CLAUDE.md Compliance

Fixes violation of: "No broad or silent catches. Never except Exception: pass or except Exception: return None. No retry/backoff loops. No fallback chains."

These are database I/O boundaries where specific exception types map to distinct, meaningful statuses (connection errors, transaction errors, etc.).

@Lightheartdevs
Copy link
Copy Markdown
Collaborator

Closing as part of v2.1.0 stabilization. We're pausing new feature PRs while we solidify the installer and CI gates. If this is still relevant for v2.2.0 (targeting April 1), please rebase and resubmit. Thank you for contributing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants