Replace broad except Exception blocks with specific exception types #15

Closed
opened 2026-02-20 06:52:26 +00:00 by cal · 1 comment
Owner

74 `except Exception` blocks across 19 files. In GET endpoints, the only expected error is `DoesNotExist`. Using `except Exception` masks database connection failures, import errors, etc., returning 404 instead of 500.

Priority: medium

74 \`except Exception\` blocks across 19 files. In GET endpoints, the only expected error is \`DoesNotExist\`. Using \`except Exception\` masks database connection failures, import errors, etc., returning 404 instead of 500. **Priority**: medium
cal added the
bug
tech-debt
labels 2026-02-20 06:52:26 +00:00
cal added the
ai-working
label 2026-03-04 01:01:17 +00:00
Author
Owner

Fixed in PR #48: #48

Replaced 71 except Exception blocks across all 19 router files with except DoesNotExist. Added DoesNotExist to each file's db_engine import (it's available via from peewee import *). Database connection errors and other unexpected exceptions will now correctly propagate as 500s rather than being masked as 404s.

Fixed in PR #48: https://git.manticorum.com/cal/paper-dynasty-database/pulls/48 Replaced 71 `except Exception` blocks across all 19 router files with `except DoesNotExist`. Added `DoesNotExist` to each file's `db_engine` import (it's available via `from peewee import *`). Database connection errors and other unexpected exceptions will now correctly propagate as 500s rather than being masked as 404s.
cal added
ai-pr-opened
and removed
ai-working
labels 2026-03-04 01:05:57 +00:00
cal closed this issue 2026-03-07 03:18:57 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/paper-dynasty-database#15
No description provided.