Skip to content

fix: improve SQLite error handling and logging in images.py and folders.py #1307

@Dotify71

Description

@Dotify71

Describe the bug

Currently, backend/app/database/images.py and backend/app/database/folders.py use broad except Exception as e: blocks for SQLite database operations instead of catching specific sqlite3.Error exceptions.

Additionally, some of these blocks may be using print() or returning generic strings instead of using the central logger to report the error properly.

This makes debugging database failures harder and is inconsistent with the error handling improvements being made in other database files (like faces.py and face_clusters.py).

Expected Behavior

  • Replace broad except Exception as e: with except sqlite3.Error as e: where appropriate.
  • Ensure all exceptions are logged using the project's logger.error(...) instead of print().

I can submit a PR to fix this! Let me know if I can be assigned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions