Is there an existing issue for this?
What happened?
Problem
The current implementation of get_db_connection in backend/app/database/connection.py catches a broad Exception when handling database operations.
Catching all exceptions can:
- Hide SQLite-specific errors
- Make debugging more difficult
- Handle unrelated runtime errors in a place meant only for database failures
- Provide no logging context when a transaction fails
Why this matters
More precise error handling improves:
- Debuggability for contributors
- Code clarity and maintainability
- Reliability of database transaction management
- Alignment with Python and database best practices
Proposed improvement
Refine the exception handling to:
- Catch
sqlite3.Error instead of a generic Exception
- Log database-related failures for better visibility
- Preserve the existing rollback and re-raise behavior
This change does not affect application logic but improves robustness and developer experience.
I would be happy to open a PR with this improvement if maintainers agree.
Record
Is there an existing issue for this?
What happened?
Problem
The current implementation of
get_db_connectioninbackend/app/database/connection.pycatches a broadExceptionwhen handling database operations.Catching all exceptions can:
Why this matters
More precise error handling improves:
Proposed improvement
Refine the exception handling to:
sqlite3.Errorinstead of a genericExceptionThis change does not affect application logic but improves robustness and developer experience.
I would be happy to open a PR with this improvement if maintainers agree.
Record