Handle JSONDecodeError in all load_* functions #12

Open
opened 2026-06-06 19:58:11 +00:00 by tonym · 0 comments

Severity: high
Category: data-integrity
Location: bills.py:12, sinking.py:29, mortgage.py:13, assets.py:49, debts.py:120/131, income.py:25

Problem

json.load raises on empty/corrupt files (e.g. after a partial write), and the exception propagates, crashing every route that loads data.

Suggested fix

Wrap in try/except json.JSONDecodeError: log + return the default, or surface a recovery path.

Filed by automated code review.

**Severity:** high **Category:** data-integrity **Location:** `bills.py:12, sinking.py:29, mortgage.py:13, assets.py:49, debts.py:120/131, income.py:25` ### Problem `json.load` raises on empty/corrupt files (e.g. after a partial write), and the exception propagates, crashing every route that loads data. ### Suggested fix Wrap in try/except json.JSONDecodeError: log + return the default, or surface a recovery path. _Filed by automated code review._
tonym added the
data-integrity
severity:high
labels 2026-06-06 19:58:11 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bonna61/Moon-Household-Budget#12
No description provided.