[Arch] No centralized exception handler; ad hoc try/except per route #53
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Severity: Low | Category: Backend
Zero
@app.exception_handlerregistrations; 16 try/13 except blocks and 52HTTPExceptionraises scattered across main.py, including broadexcept Exceptionat main.py:606-609 and 1319-1320.Recommendation: Add one
@app.exception_handler(Exception)for a consistent last-resort 500 shape + log line.Full detail:
docs/architecture-review.md§ C, Finding "No centralized exception handler..."Fixed on branch
architecture-rework, commitd95358f: added@app.exception_handler(Exception)returning the documented{"detail": "Internal server error"}shape, logging the full exception server-side without leaking it to the client. Confirmed Starlette'sServerErrorMiddlewarestill re-raises after generating the response, soTestClient(raise_server_exceptions=True)still surfaces real bugs during tests — no loss of test signal. Addedtest_unhandled_exception_returns_generic_500. Full suite: 258 passed.