store: Fix: swallowed HTTPException in recalculate_standings — use sed to avoid linter reformatting

This commit is contained in:
Cal Corum 2026-03-02 19:36:59 -06:00
parent 36fa37cfaf
commit d79fecbbb4

View File

@ -0,0 +1,42 @@
---
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:36:59.027516+00:00"
---
# 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