claude-memory/graph/fixes/fix-swallowed-httpexception-in-recalculate-standings-use-sed-a5f56c.md
2026-03-02 19:37:03 -06:00

64 lines
2.2 KiB
Markdown

---
id: a5f56cb6-9a7b-4224-98f3-aefc4cfc0a2a
type: fix
title: "Fix: swallowed HTTPException in recalculate_standings — use sed to avoid linter reformatting"
tags: [major-domo-database, fastapi, python, httpexception, linter, sed, standings]
importance: 0.7
confidence: 0.8
created: "2026-03-03T01:36:59.027516+00:00"
updated: "2026-03-03T01:37:03.490572+00:00"
relations:
- target: a64fd0a1-cf42-469a-9280-991ab85bbfb2
type: RELATED_TO
direction: outgoing
strength: 0.61
edge_id: 395d03bb-07fc-4c9c-afa1-b020ef6883c2
- target: 2a71ad5b-ba11-4fa8-8088-a1a67df8106b
type: RELATED_TO
direction: outgoing
strength: 0.58
edge_id: 7fd88df7-3e25-44cf-85a8-a2399f5bfab3
- target: 16053713-9854-4411-80e6-0cd23e70be8d
type: RELATED_TO
direction: outgoing
strength: 0.57
edge_id: ebc9c602-b1d2-48fc-9fd6-1f7106b10f2c
- target: 57e38d6f-828e-496b-af23-da7f4806252c
type: FOLLOWS
direction: outgoing
strength: 0.8
edge_id: d7fea2ee-b026-4b54-831e-df1cc16f0549
---
# Fix: Swallowed HTTPException in recalculate_standings
## Problem
`app/routers_v3/standings.py` line 124 constructed an `HTTPException` but never raised it, causing the endpoint to always return 200 even on failure.
## Root Cause
Missing `raise` keyword:
```python
# Bug
HTTPException(status_code=500, detail=f'Error recreating Standings rows')
# Fix
raise HTTPException(status_code=500, detail=f'Error recreating Standings rows')
```
## Solution
Add the single `raise` keyword. Used `sed -i` directly rather than the Edit tool, because the Edit tool triggers a linter (black/ruff) that reformats the entire file — which caused the previous PR (#40) to be rejected.
```bash
sed -i "s/ HTTPException(status_code=500, detail=f'Error recreating Standings rows')/ raise HTTPException(status_code=500, detail=f'Error recreating Standings rows')/" app/routers_v3/standings.py
```
## Key Lesson
When a repo has an auto-formatter configured as a save hook, use `sed` or `Bash` tool for surgical one-line fixes instead of the Edit tool, to avoid unintended reformatting of the whole file.
## Files Changed
- `app/routers_v3/standings.py` (1 line, 1 word added)
## PR
- Issue: major-domo-database#23
- PR: major-domo-database#41