From 23e8882de821f7e5fa8f76250cfdbc5795764d62 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 3 Mar 2026 19:18:04 -0600 Subject: [PATCH] =?UTF-8?q?store:=20PR=20review:=20paper-dynasty-database#?= =?UTF-8?q?48=20=E2=80=94=20replace=20broad=20except=20Exception=20with=20?= =?UTF-8?q?DoesNotExist=20(APPROVED)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...base48-replace-broad-except-exce-37cca1.md | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 graph/workflows/pr-review-paper-dynasty-database48-replace-broad-except-exce-37cca1.md diff --git a/graph/workflows/pr-review-paper-dynasty-database48-replace-broad-except-exce-37cca1.md b/graph/workflows/pr-review-paper-dynasty-database48-replace-broad-except-exce-37cca1.md new file mode 100644 index 00000000000..62cd4d0743e --- /dev/null +++ b/graph/workflows/pr-review-paper-dynasty-database48-replace-broad-except-exce-37cca1.md @@ -0,0 +1,28 @@ +--- +id: 37cca1c8-7fbd-43c3-a289-129b1c530f9f +type: workflow +title: "PR review: paper-dynasty-database#48 — replace broad except Exception with DoesNotExist (APPROVED)" +tags: [pr-reviewer, paper-dynasty-database, fastapi, peewee, python, exception-handling] +importance: 0.4 +confidence: 0.8 +created: "2026-03-04T01:18:04.266886+00:00" +updated: "2026-03-04T01:18:04.266886+00:00" +--- + +## PR #48: fix: replace broad except Exception blocks with DoesNotExist (#15) + +**Verdict**: APPROVED (could not post — Gitea blocks self-reviews on cal-owned repos) + +### Summary +- 71 `except Exception` blocks replaced with `except peewee.DoesNotExist` across 19 router files in `app/routers_v2/` +- `DoesNotExist` imported into each file from `..db_engine`, which re-exports it via `from peewee import *` +- Real DB errors now propagate as 500s instead of being swallowed as 404s + +### Key Findings +- **Correctness**: Change is mechanically correct. `DoesNotExist` is peewee's standard exception for `Model.get_by_id()` misses. +- **Import validity**: `db_engine.py` line 8 uses `from peewee import *`, so `DoesNotExist` is available in that namespace. All 19 import additions are valid. +- **Pre-existing minor issue**: A few handlers use `except DoesNotExist as e:` but don't include `e` in their log messages (e.g., `cards.py` `v1_cards_wipe_team`, `results.py` `get_team_results`). Pre-existing, out of scope. +- **No security concerns**. No style violations. + +### Note +Gitea raises "approve your own pull is not allowed" when the reviewer owns the repo. Self-review is blocked at the platform level — this is a known limitation for solo repos.