fix: replace bare except: with except Exception: (#29) #50
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#50
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-database-29"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Replaces all bare
except:clauses withexcept Exception:incustom_commands.pyanddb_engine.py.Bare
except:clauses catch everything includingSystemExit,KeyboardInterrupt, andGeneratorExit, which should never be silently swallowed.except Exception:restricts the catch to actual application errors.Files changed
app/routers_v3/custom_commands.py— lines 290, 387, 448, 531, 739, 824, 904, 984 (8 occurrences, all JSON parse fallbacks)app/db_engine.py— lines 461, 522, 583, 2354 (4 occurrences: 3 list.remove() fallbacks, 1 JSON parse fallback)Test results
No test suite — changes verified by reading back modified lines. All 12 replacements are purely syntactic; no logic changed.
Closes #29
AI Code Review
Files Reviewed
app/routers_v3/custom_commands.py(modified — 8 occurrences)app/db_engine.py(modified — 4 occurrences)Findings
Correctness
All 12 replacements are accurate and cover the full set of bare
except:clauses in both files. Each context was verified:db_engine.pylines 460, 521, 582:list.remove()fallbacks —ValueErroris a subclass ofException, soexcept Exception:catches correctly.db_engine.pyline 2354:json.loads()fallback —json.JSONDecodeErroris a subclass ofValueError→Exception, correct.custom_commands.pylines 290, 387, 448, 531, 739, 824, 904, 984: alljson.loads()fallbacks — same applies.No occurrences were missed and no unrelated code was touched.
Security
No issues. These are internal fallbacks with no security surface.
Style & Conventions
except Exception:is the correct Python idiom for catching application-level exceptions while allowingSystemExit,KeyboardInterrupt, andGeneratorExitto propagate. Consistent with project patterns throughout the codebase.Suggestions
get_tags_listmethod indb_engine.py(line 2352) containsimport jsoninside the method body. This is a pre-existing pattern not introduced by this PR, but worth noting for a future cleanup. (CLAUDE.md: "Never add lazy imports to middle of file".)Verdict: APPROVED
Pure correctness fix with zero logic change. All 12 bare
except:clauses correctly replaced withexcept Exception:. Ready to merge.Automated review by Claude PR Reviewer