fix: replace bare except: with except Exception: (#29) #50

Merged
cal merged 1 commits from ai/major-domo-database-29 into next-release 2026-03-10 14:35:10 +00:00
Owner

Summary

Replaces all bare except: clauses with except Exception: in custom_commands.py and db_engine.py.

Bare except: clauses catch everything including SystemExit, KeyboardInterrupt, and GeneratorExit, 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

## Summary Replaces all bare `except:` clauses with `except Exception:` in `custom_commands.py` and `db_engine.py`. Bare `except:` clauses catch everything including `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit`, 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
cal added 1 commit 2026-03-05 21:03:58 +00:00
fix: replace bare except: with except Exception: (#29)
All checks were successful
Build Docker Image / build (pull_request) Successful in 2m7s
efdbd623cf
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cal added the
ai-reviewing
label 2026-03-05 21:15:36 +00:00
cal reviewed 2026-03-05 21:16:23 +00:00
cal left a comment
Author
Owner

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.py lines 460, 521, 582: list.remove() fallbacks — ValueError is a subclass of Exception, so except Exception: catches correctly.
  • db_engine.py line 2354: json.loads() fallback — json.JSONDecodeError is a subclass of ValueErrorException, correct.
  • custom_commands.py lines 290, 387, 448, 531, 739, 824, 904, 984: all json.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 allowing SystemExit, KeyboardInterrupt, and GeneratorExit to propagate. Consistent with project patterns throughout the codebase.

Suggestions

  • The get_tags_list method in db_engine.py (line 2352) contains import json inside 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 with except Exception:. Ready to merge.


Automated review by Claude PR Reviewer

## 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.py` lines 460, 521, 582: `list.remove()` fallbacks — `ValueError` is a subclass of `Exception`, so `except Exception:` catches correctly. - `db_engine.py` line 2354: `json.loads()` fallback — `json.JSONDecodeError` is a subclass of `ValueError` → `Exception`, correct. - `custom_commands.py` lines 290, 387, 448, 531, 739, 824, 904, 984: all `json.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 allowing `SystemExit`, `KeyboardInterrupt`, and `GeneratorExit` to propagate. Consistent with project patterns throughout the codebase. #### Suggestions - The `get_tags_list` method in `db_engine.py` (line 2352) contains `import json` inside 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 with `except Exception:`. Ready to merge. --- *Automated review by Claude PR Reviewer*
cal added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-05 21:16:48 +00:00
cal changed target branch from main to next-release 2026-03-07 07:32:42 +00:00
cal merged commit d04649f12d into next-release 2026-03-10 14:35:10 +00:00
cal deleted branch ai/major-domo-database-29 2026-03-10 14:35:10 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#50
No description provided.